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:-
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:-
0 Comments: