
Untitled
By: a guest on
Sep 16th, 2012 | syntax:
C | size: 0.96 KB | hits: 16 | expires: Never
#include <stdio.h>
int main()
{
float num1, num2;
char choice;
printf("Current pressure?\n");
scanf("%f", &num1);
if ( num1 < 1013.2 )
{
printf("The weather is bad right now.\n");
}
else if ( num1 > 1013.2 )
{
printf("The weather is good right now.\n");
}
printf("Is the pressure rising or falling? (r/f) :\n");
scanf(" %c",&choice);
if ( choice == 'r' )
{
printf("The weather is good, and getting better!\n");
printf("Thanks for the answer!\n");
}
else if ( choice == 'f' )
{
printf("The weather is bad, and getting worse!\n");
printf("Thanks for the answer!\n");
}
else
{
printf("Illegal entry, exiting\n");
}
system("PAUSE");
return 0;
}