======Project: If Statements======
A project for CSCS 1320 by Paul Sechrist during the Spring 2013.
=====Objectives=====
C program must:
* Ask the user to enter a number
* place entered value into a variable
* display a message accordingly
* if value < 50 "You suck"
* if value == 50 "Way to ruin the joke."
* if value > 50 "Well, someone's over compensating."
*
=====Code=====
#include
int main()
{
int a;
fprintf(stdout, "Please enter a number:\n");
fscanf(stdin,"%u", &a);
if (a<50)
{
fprintf(stdout, "YOU SUCK! \n");
}
else if (a==50)
{
fprintf(stdout, "you ruined the joke....\n");
}
else if (a>50)
{
fprintf(stdout, "Wellllll, someone's over compensating");
}
return(0);
}
=====Execution=====
lab46:~/src$ ./numif
Please enter a number:
1
YOU SUCK!
lab46:~/src$ ./numif
Please enter a number:
50
you ruined the joke....
lab46:~/src$ ./numif
Please enter a number:
100
Wellllll, someone's over compensating....
lab46:~/src$
=====Reflection=====
Fairly easy, good way to learn how to use if statements.
=====References=====
Kellen kinda helped.... a bit.