Programming Examples

Write a program to find the maximum number out of six numbers


Write a program to find the maximum number out of six numbers invoked though the keyboard.

Solution

void main()
{
int a,b,c,d,e,f;
clrscr();
printf(“Enter 1st number:”);
scanf(“\n%d”,&a);
printf(“Enter 2nd number:”);
scanf(“\n%d”,&b);
printf(“Enter 3 rd number:”);
scanf(“\n%d”,&c);
printf(“Enter 4th number:”);
scanf(“\n%d”,&d);
printf(“Enter 5th number:”);
scanf(“\n%d”,&e);
printf(“Enter 6th number:”);
scanf(“\n%d”,&f);
if((a>b)&&(a>c)&&(a>d)&&(a>e)&&(a>f))
printf(“Maximum out of six Numbers is : %d”,a);
else if((b>c)&&(b>d)&&(b>e)&&(b>f))
printf(“Maximum out of six Numbers is : %d”,b);
else if((c>d)&&(c>e)&&(c>f))
printf(“Maximum out of six Numbers is :%d”,c);
else if((d>e)&&(d>f))
printf(“Maximum out of six Numbers is : %d”,d);
else if(e>f)
printf(“Maximum out of six Numbers is : %d”,e);
else
printf(“Maximum out of six Numbers is : %d”,f);
getch();
}
Output

OUTPUT:

Enter 1st number:23

Enter 2nd number:45

Enter 3rd number:67

Enter 4th number:89

Enter 5th number:80

Enter 6th number:90

Maximum out of six Numbers is : 90

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