|
Description
This is an example of
an if / else statement
Code
/*shows an if
else example*/
#include <stdio.h>
main()
{
int result;
/*display message*/
puts("Please enter yor grade.\n");
/*get user input*/
scanf("%d" ,&result);
/*check result and display a message*/
if(result<50)
puts("You failed.\n");
else
puts("You passed.\n");
return 0;
}
Information
tested using LCC Win
32 , Visual C++ 6
|