
GtoS
By:
ogmamx on
May 26th, 2012 | syntax:
None | size: 0.78 KB | hits: 25 | expires: Never
#include <stdio.h>
#include <conio.h>
//This program will read 3 numbers, and print from greatest to smallest
void main (void){
int a,b,c;
clrscr();
printf("\nGive me the first number: ");
scanf("%d", &a);
printf("\nGive me the second number: ");
scanf("%d", &b);
printf("\nGive me the third number: ");
scanf("%d", &c);
clrscr();
if (a<b<c){
printf("Greatest number: C= %d Middle Number: B= %d Smallest Number: A= %d",c,b,a);
getch();
}
else{
if (b<c<a){
printf("Greatest number: A= %d Middle Number: C= %d Smallest Number: B= %d",a,c,b);
getch();
}
else{
if (c<a<b){
printf("Biggest Number: B= %d Middle Number: A= %d Smallest Number: C= %d",b,a,c);
getch();
}
}
}
}