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
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.
What does a function declared as pascal do differently?
What are dangling pointers in c?
Explain what is the difference between the expression '++a' and 'a++'?
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
What will be the outcome of the following conditional statement if the value of variable s is 10?
What is a newline escape sequence?
what is a NULL Pointer? Whether it is same as an uninitialized pointer?
How are strings stored in c?
Write a program to check prime number in c programming?
What is null pointer constant?
What is the correct code to have following output in c using nested for loop?
What is data structure in c language?
What is the importance of c in your views?
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); } }