Don't like ads? PRO users don't see any ads ;-)

Guest

GtoS

By: ogmamx on May 26th, 2012  |  syntax: None  |  size: 0.78 KB  |  hits: 25  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include <stdio.h>
  2. #include <conio.h>
  3.  
  4. //This program will read 3 numbers, and print from greatest to smallest
  5. void main (void){
  6.    int a,b,c;
  7.    clrscr();
  8.    printf("\nGive me the first number: ");
  9.    scanf("%d", &a);
  10.    printf("\nGive me the second number: ");
  11.    scanf("%d", &b);
  12.    printf("\nGive me the third number: ");
  13.    scanf("%d", &c);
  14.    clrscr();
  15.    if (a<b<c){
  16.       printf("Greatest number: C= %d Middle Number: B= %d Smallest Number: A= %d",c,b,a);
  17.       getch();
  18.    }
  19.    else{
  20.    if (b<c<a){
  21.       printf("Greatest number: A= %d Middle Number: C= %d Smallest Number: B= %d",a,c,b);
  22.       getch();
  23.    }
  24.    else{
  25.    if (c<a<b){
  26.       printf("Biggest Number: B= %d Middle Number: A= %d Smallest Number: C= %d",b,a,c);
  27.       getch();
  28.    }
  29.    }
  30.    }
  31. }