C program to enter the five subjects marks and find percentage of a student - My CS Tutorial

Breaking

Programming languages full tutorial and programs, exam papers, visual basic( Vb.net ), information of new technologies and more....

Saturday, June 15, 2019

C program to enter the five subjects marks and find percentage of a student

In this program we will find the percentage of a student. In this program we will enter the value of five subject as hindi,english, math, physics and chemistry and find the percentage of a student.


Solution

  • In this program we will use five subjects numbers so we will take five variables for all subjects and one variables for percentage's value.
  • We declared these variables in float data type.
  • Then we will enter the value of five subjects.
  • We use one logic for find the percentage of a student.Which are as...                                                       per=(hindi+eng+math+phy+che)*100/500;
  • When we use this statement the value of these operations will be store in percentage(per) variable.
  • Then we will print the value of percentage of a student.


C program code


#include<stdio.h>
#include<conio.h>
void main()
{
float hindi,eng,math,phy,che,per;
clrscr();

printf("\n Enter the value of hindi=");
scanf("%f",&hindi);

printf("\n Enter the value of english=");
scanf("%f",&eng);

printf("\n Enter the value of math=");
scanf("%f",&math);

printf("\n Enter the value of physics=");
scanf("%f",&phy);

printf("\n Enter the value of chemistry=");
scanf("%f",&che);

per=(hindi+eng+math+phy+che)*100/500;

printf("\n The percentage of a student is=%f",per);
getch();
}



Output 1:




Output 2:




we will enter the value of five subject as hindi,english, math, physics and chemistry and find the percentage of a student.we will use five subjects numbers so we will take five variables for all subjects and one variables for percentage's value.

No comments:

Post a Comment