Statement of C Program: This Program prints the Largest Number among two Numbers by using Function.
#include<stdio.h>
#include<conio.h>
void main()
{
float a , b , max;
clrscr();
float large(float x , float y); /* Function declaration */printf(" Enter the value of two numbers\n");
scanf("%f%f" , &a , &b);
printf("a = %f and b = %f\n" , a, b);
max = large(a,b);
printf(" The largest number is = %f\n" , max);
} /* End of main() */
/* Function to determine the largest number */
float large(float x , float y)
{
if(x>y)
{
return(x);
}
else /* ( y>x ) */
{
return(y);
}
}
Output:
12.5
10.5
a = 12.5 and b = 10.5
The largest number is = 12.5
That's All
0 Response to "WAP to Find the Largest Number among Two Numbers by using Function"
Post a Comment