Home Segments Index Top Previous Next

84: Mainline

Just as the character-string supplied to printf can contain many print specifications, the character-string supplied to scanf can contain many read specifications as well. The following main function picks up three values:

#include  
main ( ) { 
  int sum, size_one, size_two, size_three; 
  printf ("Please type three trade sizes.\n"); 
  scanf ("%i%i%i", &size_one, &size_two, &size_three); 
  sum = size_one + size_two + size_three; 
  printf ("The sum of the trade sizes is %i.\n", sum); 
}