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 <stdio.h>
float product(float i, int j)
{
	float pr;
	pr = i*j;
	return pr;
}
int  main( )
{
	float a, p;
	int b;
	printf("Enter Float Value :");
	scanf("%f",&a);
	printf("\nEnter Integer Value :");
	scanf("%d",&b);
	p = product(a,b);
	printf("\nThe product is %.2f\n", 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