Saturday, 7 March 2015

C Program To Find A Percentage Of Marks

Problem :- Write A C Program To Find A Percentage Of Marks .

Logic :- First We take input marks Of All 6 Subject from User ,then we add all subject and after that divide by number or subject 

Formula :- 

Percentage = Sum of all Subject / Number of Subject 

Solution :-

#include<stdio.h>
main()
{
int ph,ch,math,eng,sc,sci;
float per;

printf("Enter The Marks Of Subject ph,ch,math,eng,sc,sci\n");
scanf("%d%d%d%d%d%d" ,&ph,&ch,&math,&eng,&sc,&sci);

per=(ph+ch+math+eng+sc+sci)/6;

printf("\nPercentage = %f\n",per);


}

Output:-

C Program To Find A Percentage Of Marks

No comments:
Write comments

Recommended Posts × +