Programming Examples

Write a program to find the largest number out of three numbers


Write a program to find the largest number out of three numbers. Read the numbers through the keyboard?

Solution

void main()
{
int x,y,z;
clrscr();
printf(“\nEnter Three Numbers x, y, z :”);
scanf(“%d %d %d”, &x,&y,&z);
printf(“\nLargest out of Three Numbers is :”);
if(x>y)
{
 if(x>z)
 printf(“x=%d\n”,x);
 else
 printf(“z=%d\n”,z);
}
 else
 {
 if(z>y)
 printf(“z=%d\n”,z);
 else
 printf(“y=%d\n”,y);
 }
}
Output

OUTPUT:

Enter Three Numbers x, y, z : 10 20 30

Largest out of Three Numbers is :z=30

Latest Current Affairs 2024 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test 2024 Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Sarkari Exam Quiz