C program to read marks and print percentage and division

In this C program, we are going to read marks in 3 subjects, we will find the total, percentage and print the division based on the percentage.
Submitted by Manju Tomar, on October 09, 2017

Problem statement

Given (or input from the user) marks in 3 subjects and we have to calculate parentage and print the division.

Formula to get percentage

Formula to get percentage: Total obtained marks *100/Grand total (total of maximum marks)

Conditions to find division


Based on the percentage, we will print the division, if percentage is:

  1. Greater than or equal to 60, division will be "First"
  2. Greater than or equal to 50, division will be "Second"
  3. Greater than or equal to 40, division will be "Third"
  4. Less than it (we will not check any condition, it will be written in else), the result will be fail

C program to read marks and print percentage and division

int main()
	int science; 
	int math;
	int english;
	int total;
	float per;

	science = 50;
	math = 90;
	english = 40;
	//you can take input from user instead of these values

	//calculating total
	total= science + math + english;
	//calculating percentage
	per= (float) total*100/300;

	printf("Total Marks: %d\n",total);
	printf("Percentage is: %.2f\n",per);

	//checking division and printing
		printf("First division\n");
	else if(per>=50)
		printf("Second division");
	else if(per>=40)
		printf("Third division");
	return 0;


Total Marks: 180
Percentage is: 60.00
First division

This is a simple C program, if you are a beginner you will learn to calculate total, percentage and how to find division (example of multiple if else).

If liked or any issue with the program, feel free to leave your comment.

C Basic Programs »

Related Programs

Comments and Discussions!

Load comments ↻

Copyright © 2024 www.includehelp.com. All rights reserved.