Marks Percentage Calculator C Program

By | June 16, 2019
Marks percentage Calculator Program in C Language

Marks percentage Calculating Program in C Language

Today we will learn how to write a C language program to work as marks percentage calculator. If we wish to calculate the percentage obtained by a student, we will use this C language program.

This program uses simple C language statements. The detail of the statements used in this C language program is as follows:

  1. Writing basic C language program template that is basic structure of C program.
  2. Using variable declarations
  3. Use of printf() for output / displaying messages to user of program.
  4. using scanf() function as input statement.
  5. We will use simple assignment statement to calculate marks percentage.
  6. This is the whole story about marks percentage calculating  program in C language.

The Source Code for Marks Percentage Calculator

/* Marks Percentage Calculator */

#include<stdio.h>

int main()
{
float obtainedMarks, totalMarks, percentage;
printf(“Enter the Obtained Marks of a Student:”);
scanf(“%f”, &obtainedMarks);
printf(“Enter the Total Marks:”);
scanf(“%f”, &totalMarks);

percentage = obtainedMarks / totalMarks * 100.0;

printf(“Required Marks Percentage = %.2f %%”,percentage);

return 0;
}

Loading

Leave a Reply

Your email address will not be published. Required fields are marked *