Ghislain_Mike

Greatest of three numbers

Feb 8th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.47 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main() {
  5.   int A, B, C;
  6.  
  7.   printf("Enter 1st number = ");
  8.   scanf("%d", &A);
  9.  
  10.   printf("Enter 2nd number = ");
  11.   scanf("%d", &B);
  12.  
  13.   printf("Enter 3nd number = ");
  14.   scanf("%d", &C);
  15.  
  16.   if (A > B && A > C) {
  17.     printf("%d is the greatest.", A);
  18.  
  19.   } else if (B > A && B > C) {
  20.     printf("%d is the greatest.", B);
  21.  
  22.   } else if (C > B && C > A) {
  23.     printf("%d is the greatest.", C);
  24.  
  25.   }
  26.  
  27.   return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment