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
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 |
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 |
read an array and search an element
The C language terminator is a.semicolon b.colon c.period d.exclamation mark
Is it possible to create recycle bin in mobiles?
can anyone please tell about the nested interrupts?
difference between i++* and *++i
what is difference between ++(*p) and (*p)++
17 Answers Accenture, HCL, IBM,
what is difference between array of characters and string
What is the use of f in c?
how to write palindrome program?
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?
wat is the output #define VOLEDEMORT _who_must_not_be_named int main() { printf("VOLEDEMORT"); }
write the program to find multiplication of 2-D matrix??????????