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

Declare the structure which contains the following members and write in C list of all students who score more than 75 marks. Roll No, Name, Father Name, Age, City, Marks.

884


What does a function declared as pascal do differently?

735


What are dangling pointers in c?

783


Explain what is the difference between the expression '++a' and 'a++'?

801


A function can make the value of a variable available to another by a) declaring the variable as global variable b) Passing the variable as a parameter to the second function c) Either of the two methods in (A) and (B) d) binary stream

853






What will be the outcome of the following conditional statement if the value of variable s is 10?

968


What is a newline escape sequence?

801


what is a NULL Pointer? Whether it is same as an uninitialized pointer?

943


How are strings stored in c?

736


Write a program to check prime number in c programming?

751


What is null pointer constant?

747


What is the correct code to have following output in c using nested for loop?

743


What is data structure in c language?

758


What is the importance of c in your views?

734


What is the purpose of the following code? Is there any problem with the code? void send(int count, short *to, short *from) { /* count > 0 assumed */ register n = (count + 7) / 8; switch (count % 8) { case 0: do { *to = *from++; case 7: *to = *from++; case 6: *to = *from++; case 5: *to = *from++; case 4: *to = *from++; case 3: *to = *from++; case 2: *to = *from++; case 1: *to = *from++; } while (--n > 0); } }

2170