Write a c program to sort six numbers and find the largest
one by using the ladder of if-else?
plz do help me
Answer Posted / jugal k. sewag
#include<stdio.h>
#include<conio.h>
void main(){
int a,b,c,d,e,f;
int max;
clrscr();
printf("Enter any six numbers: ");
scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f);
if(a>=b && a>=c && a>=d && a>=e && a>=f)
max =a;
else if(b>=c && b>=d && b>=e && b>=f)
max=b;
else if(c>=d && c>=e && c>=f)
max=c;
else if(d>=e && d>=f)
max=d;
else if(e>=f)
max=e;
else
max=f;
printf("Max among six number is: %d",max);
getch();
}
| Is This Answer Correct ? | 14 Yes | 12 No |
Post New Answer View All Answers
What are the Advantages of using macro
What is the use of structure padding in c?
Can you explain the four storage classes in C?
What is the value of uninitialized variable in c?
Can we replace the struct function in tree syntax with a union?
What are nested functions in c?
What are loops c?
What are multidimensional arrays?
Is c high or low level?
Explain bit masking in c?
Is c easier than java?
What is c system32 taskhostw exe?
write a c program for swapping two strings using pointer
Describe the difference between = and == symbols in c programming?
program to find out date after adding 31 days to a date in the month of febraury also consider the leap year