Programs make decisions
Without branching, a program is a fixed list of steps. if is what makes it react to data.
#include <stdio.h>
int main(void)
{
int marks;
printf("Marks: ");
if (scanf("%d", &marks) != 1) return 1;
if (marks >= 90)
printf("Grade O\n");
else if (marks >= 75)
printf("Grade A\n");
else if (marks >= 40)
printf("Grade B\n");
else
printf("Fail\n");
return 0;
}
The order matters. Because the checks run top to bottom and stop at the first true one, marks = 95 never reaches the >= 75 test. Write the ranges from highest to lowest and the logic stays simple.