yoyo106

Max and min number

Mar 19th, 2018
101
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. {
  6.     int a,b,z,Max,Min;
  7.         printf("Enter three integers: ");
  8.         scanf("%d%d%d",&a,&b,&z);
  9.     if (a>=b)
  10.         {
  11.             Max=a;
  12.             Min=b;
  13.         }
  14.     else
  15.  
  16.         {
  17.             Min=a;
  18.             Max=b;
  19.         }
  20.     if (z>=Max)
  21.     {
  22.         Max=z;
  23.     }
  24.     else if (z<=Min)
  25.     {
  26.         Min=z;
  27.     }
  28.         printf("Max is %d\tMin is %d",Max,Min);
  29.  
  30.     return 0;
  31. }
Add Comment
Please, Sign In to add comment