home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / C / SASC6571.LZX / tutorial / 2_2_1.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-03-27  |  486 b   |  20 lines

  1. #include "stdio.h"
  2.  
  3. main( )
  4. {
  5.     float num_one, num_two;
  6.     int choice;
  7.     
  8.     printf("Enter the first number: ");
  9.     scanf("%f", &num_one);
  10.     
  11.     printf("Enter the second number: ");
  12.     scanf("%f", &num_two);
  13.     
  14.     printf("To multiply the numbers enter 0, to add them enter 1: ");
  15.     scanf("%d", &choice);
  16.     
  17.     if(choice) printf("The sum of the two numbers is: %f.\n", num_one + num_two); else printf("The product of the two numbers is: %f.\n", num_one * num_two);
  18. }
  19.  
  20.