SHARE
TWEET

Untitled

a guest Jun 19th, 2017 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2.  
  3. main( int argc, char *argv[])
  4. {
  5.     int num1, num2, num3, sum, average, product;
  6.    
  7.     printf("First number: \n");
  8.     scanf("%d", &num1);
  9.    
  10.     printf("Second number: \n");
  11.     scanf("%d", &num2);
  12.    
  13.     printf("Last number: \n");
  14.     scanf("%d", &num3);
  15.    
  16.     sum = num1 + num2 + num3;
  17.     average = sum / 3;
  18.     product = num1 * num2 * num3;
  19.    
  20.     printf("Sum: %d.\n", sum);
  21.     printf("Average: %d.\n", average);
  22.     printf("Product: %d.\n", product);
  23.    
  24.     //Finding the smallest number
  25.     smallest = num1;
  26.     if (num1 < num2)
  27.     if (num2 < num1)
  28.         smallest = num2;
  29.     if (num3 < num2)
  30.         smallest = num3;
  31.     else if (num3 < num1)
  32.         smallest = num3;
  33.     printf("The smallest number is %d\n", smallest);
  34.  
  35.  
  36.     return 0;
  37. }
RAW Paste Data
Top