C++ 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().

//C++ 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().


#include <iostream>
using namespace std;
float product(float i, int j)
{
	float pr;
	pr = i*j;
	return pr;
}
int main() 
{
	float a, p;
	int b;
	cout << "Enter Float Value :";
	cin >> a;
	cout << "\nEnter Integer Value :";
	cin >> b;
	p = product(a,b);
	cout << "\nThe product is "<< p;
              return 0;
}

Output :
Enter the two values to find the product(float x int): 25.5
2

The product is 51.00



Leave a comment