gokussjx

Find the largest number(s) (C)

Jun 24th, 2012
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.64 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <conio.h>
  3.  
  4. clrscr();
  5.  
  6. int main()
  7.  
  8. {
  9.  
  10.     int a, b, c;
  11.  
  12.     printf("Enter first number: ");
  13.     scanf("%d", &a);
  14.  
  15.     printf("Enter second number: ");
  16.     scanf("%d", &b);
  17.  
  18.     printf("Enter third number: ");
  19.     scanf("%d", &c);
  20.  
  21.  
  22.     if((a >= b)&(a >= c))
  23.     {
  24.         printf("%d is the largest number", a);
  25.  
  26.     }
  27.  
  28.     else if(b == c)
  29.     {
  30.         printf("%d is the largest number", b);
  31.     }
  32.  
  33.     if((b > a)&(b > c))
  34.     {
  35.         printf("%d is the largest number", b);
  36.     }
  37.  
  38.     if((c > a)&(c > b))
  39.     {
  40.         printf("%d is the largest number", c);
  41.     }
  42.  
  43.  
  44.     return 0;
  45.  
  46. }
Advertisement
Add Comment
Please, Sign In to add comment