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


Please Help Members By Posting Answers For Below Questions

Difference between MAC vs. IP Addressing

637


What are the different types of linkage exist in c?

611


What are the salient features of c languages?

621


Is c easier than java?

567


What are header files? What are their uses?

634






What extern c means?

529


praagnovation

1774


#include show(int t,va_list ptr1) { int a,x,i; a=va_arg(ptr1,int) printf(" %d",a) } display(char) { int x; listptr; va_star(otr,s); n=va_arg(ptr,int); show(x,ptr); } main() { display("hello",4,12,13,14,44); }

764


What is the easiest sorting method to use?

632


"C" language developed by "Dennis Ritchie" at AT & T. his remarks are a) too general, too abstract b) could deal with only specific problems c) lost generality of BCPL and B restored d) no remarks

652


how to count no of words,characters,lines in a paragraph.

3899


What does printf does?

741


Is a house a mass structure?

639


what are enumerations in C

720


Why c language is called c?

567