If(condition a)
Then
Statement b
Else
Statement c
To illustrate this, I will use the grading system for a school to determine which grade the student is worth receiving depending on their mark score.
#include
int main()
{
// declare the variables mark and grade to be of type int and char respectively
int mark;
char grade;
// Request the user to enter the students score
printf("Enter Students scoren");
scanf("%d", &mark);
// Using selection, place a respective grade for the students score
if(mark >= 80 ) Then
Grade ='A';
Else if(mark >= 70) Then
Grade ='B';
Else if(mark >= 60) Then
Grade ='C';
Else if(mark >= 50) Then
Grade ='D';
Else
Grade ='F';
// Print the students mark and their grade
printf("The students grade is %d for a mark of %d n", sum, mark);
return 0;
}
What are other operators that could be used to sum or average a grade in your program?