#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int mark[5], i;
float sum=0;
printf("\n Enter marks obtained in Physics, Chemistry, Maths, Social Studies, English ");
for(i=1; i<=5; i++)
{
printf("\n Subject %d=",i);
scanf("%d",&mark[i]);
sum=sum+mark[i];
}
float avg=sum/5;
float perc;
perc=(sum/500)*100;
printf("\n Average Marks = %f",avg);
printf("\n Percentage = %f%",perc);
getch();
}
Run:
Previous Next
#include<conio.h>
void main()
{
clrscr();
int mark[5], i;
float sum=0;
printf("\n Enter marks obtained in Physics, Chemistry, Maths, Social Studies, English ");
for(i=1; i<=5; i++)
{
printf("\n Subject %d=",i);
scanf("%d",&mark[i]);
sum=sum+mark[i];
}
float avg=sum/5;
float perc;
perc=(sum/500)*100;
printf("\n Average Marks = %f",avg);
printf("\n Percentage = %f%",perc);
getch();
}
Run:
Previous Next
No comments:
Post a Comment