ogmamx

GtoS

May 26th, 2012
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment