#include<stdio.h>
#include<conio.h>
void largest()
{
int a,b,c,l;
printf("Enter three numbers \n");
scanf("%d%d%d",&a,&b,&c);
l=a;
if(b>l)
l=b;
if(c>l)
l=c;
printf("Largest =%d\n",l);
}
void main()
{
clrscr();
largest();
getch();
}
OUTPUT:
Enter three numbers
5 6 7
Largest=7
EXPLANATION:
The function largest() is to find the largest of three numbers.Its header indicates that it requires no argument and it does not return any value>IN the body of the function four variables are declared a,b and c are to collect three numbers.l is to collect the largest of them.The statements which follow, accept three numbers, find the largest of them and display it.
In the main(),largest() is invoked by just specifying its name and a pair of parentheses.the actual execution starts from and ends with main() only.When largest(); is encountered in main(), control is transferred to the function largest().upon completion of its execution,the control is regained by the main().
#include<conio.h>
void largest()
{
int a,b,c,l;
printf("Enter three numbers \n");
scanf("%d%d%d",&a,&b,&c);
l=a;
if(b>l)
l=b;
if(c>l)
l=c;
printf("Largest =%d\n",l);
}
void main()
{
clrscr();
largest();
getch();
}
OUTPUT:
Enter three numbers
5 6 7
Largest=7
EXPLANATION:
The function largest() is to find the largest of three numbers.Its header indicates that it requires no argument and it does not return any value>IN the body of the function four variables are declared a,b and c are to collect three numbers.l is to collect the largest of them.The statements which follow, accept three numbers, find the largest of them and display it.
In the main(),largest() is invoked by just specifying its name and a pair of parentheses.the actual execution starts from and ends with main() only.When largest(); is encountered in main(), control is transferred to the function largest().upon completion of its execution,the control is regained by the main().
No comments:
Post a Comment