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;
}

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 ( )

M.A Siddiqui

Hi, I am M.A Siddiqui. I'm a Computer Science Student, In this website, I'm teaching you Multiple languages and provides Projects and other Subjects Notes.

You may also like...

Leave a Reply

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