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 / sandeep kumar yadav. by m.c.a

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c,d,e,f,max;
clrscr();
printf("Enter the six Number \n");
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>a && b>c && b>d && b>e && b>f)
max=b;
else if(c>a && c>b && c>d && c>e && c>f)
max=c;
else if(d>a && d>b && d>c && d>e && d>f)
max=d;
else if(e>a && e>b && e>c && e>d && e>f)
max=e;
else if(f>a && f>b && f>c && f>d && f>e)
max=f;
printf("\n\n Maximum Number is = %d",max);
getch();
}

Is This Answer Correct ?    35 Yes 9 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are pointers? Why are they used?

633


List the variables are used for writing doubly linked list program.

1626


What is the difference between new and malloc functions?

584


What is a struct c#?

606


Difference between goto, long jmp() and setjmp()?

712






why return type of main is not necessary in linux

1710


What is a const pointer in c?

675


What is pointer to pointer in c language?

600


What is strcpy() function?

662


What are void pointers in c?

576


What is file in c preprocessor?

658


Explain logical errors? Compare with syntax errors.

633


Apart from dennis ritchie who the other person who contributed in design of c language.

817


What are the types of arrays in c?

627


Write a program to check prime number in c programming?

604