Write a c program to sort six numbers and find the largest
one by using the ladder of if-else?


plz do help me

Answers were Sorted based on User's Feedback



Write a c program to sort six numbers and find the largest one by using the ladder of if-else? ..

Answer / 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

Write a c program to sort six numbers and find the largest one by using the ladder of if-else? ..

Answer / 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

More C Interview Questions

read an array and search an element

1 Answers  


The C language terminator is a.semicolon b.colon c.period d.exclamation mark

6 Answers   TCS,


Is it possible to create recycle bin in mobiles?

2 Answers  


can anyone please tell about the nested interrupts?

0 Answers  


difference between i++* and *++i

6 Answers   IBM,






what is difference between ++(*p) and (*p)++

17 Answers   Accenture, HCL, IBM,


what is difference between array of characters and string

18 Answers   Accenture, Nest,


What is the use of f in c?

0 Answers  


how to write palindrome program?

3 Answers  


Why data types in all programming languages have some range? Why ritche have disigned first time likethat?Why not a single data type can support all other types?

2 Answers   Excel,


wat is the output #define VOLEDEMORT _who_must_not_be_named int main() { printf("VOLEDEMORT"); }

2 Answers  


write the program to find multiplication of 2-D matrix??????????

1 Answers  


Categories