Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

The difference between printf and fprintf is ?

1346


Tell me what is null pointer in c?

1133


What are the 4 types of functions?

1112


What are the complete rules for header file searching?

1132


C program execution always begins with a) #include b) comment (/*-------*/) c) main() d) declaration instructions

1108


Explain what are the advantages and disadvantages of a heap?

1129


Can math operations be performed on a void pointer?

1105


What is the heap in c?

1125


Are global variables static in c?

1218


Explain which of the following operators is incorrect and why? ( >=, <=, <>, ==)

1091


Write a program to check whether a number is prime or not using c?

1109


What is a nested loop?

1182


What is #pragma statements?

1159


What is the difference between a free-standing and a hosted environment?

1196


What is use of null pointer in c?

1060