C Program To Display Student Results

The C program to display student results demonstrates the working of conditional statement in the C language. The program takes student’s marks in percentage (%) as input , process the input value and displays the results (pass or fail) as output.

The output depends on the conditional statement in the example program.

Learn C programming basics before you begin with this example program.

Problem Definition

The program decides whether a student has passed or failed an exam. If the input is in percentage mark ( say 70%), a simple conditional statement checks if given percentage mark is below 40%.

( mark < 40)

The student result is a pass when mark is above 40% , else the student has failed. The result is displayed at the console.Here we list the steps involved in processing input values.

  1. Receive input in percentage mark (%)
  2. Check if the given mark is above below 40%
  3. If below 40%, then the student has failed
  4. Else the student passed.
  5. Display the result.

Flowchart – Display Student Results

The program start at the top (Start) and terminates where it says, (End) in the flowchart.

Flowchart - C Program to Display Student Results
Flowchart – C Program to Display Student Results

Program Code – Display Student Results

/*Show result of student using Marks */
#include <stdio.h>
#include <conio.h>
int main()
    int marks,i;
    /* Read student marks */
    printf("Enter the marks (in percentage ) of Student:");
    /* display result */
    if(marks < 40)
        printf("Result = Failed\n");
        printf("Result = Passed\n");
    return 0;


The student entered his or her mark which is 60%. The given mark are above 40%, required condition to pass the exam. Hence, the student result is passed.

Enter the marks ( in percentage ) of Student:60
Result = Passed
3.9/5 - (14 votes)