Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Sep 16th, 2012  |  syntax: C  |  size: 0.96 KB  |  hits: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include <stdio.h>
  2.  
  3. int main()
  4.  
  5. {
  6.  
  7.   float num1, num2;
  8.   char choice;
  9.  
  10.    printf("Current pressure?\n");
  11.          scanf("%f", &num1);
  12.          
  13.          
  14.          if ( num1 < 1013.2 )
  15.          {
  16.            printf("The weather is bad right now.\n");          
  17.          }
  18.          
  19.          else if ( num1 > 1013.2 )
  20.          {
  21.            printf("The weather is good right now.\n");              
  22.          }    
  23.        
  24.      printf("Is the pressure rising or falling? (r/f) :\n");
  25.      scanf(" %c",&choice);
  26.  
  27.  
  28.          
  29.          if ( choice == 'r' )
  30.          {
  31.            printf("The weather is good, and getting better!\n");
  32.            printf("Thanks for the answer!\n");
  33.            
  34.            
  35.            
  36.            
  37.          }        
  38.    
  39.          else if ( choice == 'f' )
  40.          {
  41.            printf("The weather is bad, and getting worse!\n");
  42.            printf("Thanks for the answer!\n");
  43.          }
  44.  
  45.  
  46.          else
  47.          {
  48.            printf("Illegal entry, exiting\n");
  49.          }
  50.  
  51.    system("PAUSE");
  52.          
  53.  
  54. return 0;
  55.  
  56. }