Function receives a float and an int from main ( ) finds the product of these two and returns the product which is printed through main ( )

Function receives a float and an int from main ( ), and product of these two Numbers

Write a function which receives a float and an int from main ( ), finds the product of these two and returns the product which is printed through main ( )

Object: Write a function that receives a float and an int from main ( ), finds the product of these two and returns the product which is printed through main ( ). C++ projects for beginners with source code

Code:

#include<iostream>
#include<conio.h>
using namespace std;

float prod(float a, int b);

void main()
{
float num1;
int num2;
cout<<“Enter Decimal value: “;
cin>>num1;
cout<<“Enter Integer value: “;
cin>>num2;
cout<<“Product of Two Numbers is: “<<prod(num1,num2);

getch();
}
float prod(float a, int b)
{
float pro;
pro=a*b;
return pro;
}

#include<iostream>
#include<conio.h>
using namespace std;

float prod(float a, int b);

void main()
{
	float num1;
	int num2;
	cout<<"Enter Decimal value: ";
	cin>>num1;
	cout<<"Enter Integer value: ";
	cin>>num2;
	cout<<"Product of Two Numbers is: "<<prod(num1,num2);

	getch();
}
float prod(float a, int b)
{
	float pro;
	pro=a*b;
	return pro;
}

Output:

Function receives a float and an int from main ( ), finds the product of these two and returns the product which is printed through main ( )

1 thought on “Function receives a float and an int from main ( ) finds the product of these two and returns the product which is printed through main ( )”

  1. Some really wonderful work on behalf of the owner of this site, utterly outstanding subject matter.

Leave a Comment

Your email address will not be published. Required fields are marked *