[Let Us C Solution ] C Program TO Find Average Of Given Subjects Marks
#include<stdio.h> /*program uing goto ,if,logic opreater */
#include<windows.h>
#include<conio.h>
void main(){
float total,avg,mark1,mark2,mark3,mark4,mark5;
system("cls");
printf("\n\n\t\t FIND AGGRETE AND AVG MARKS OF STUDENT \n\n");
printf("\n\n\tPLEASE ENTER MARKS IN GIVEN SUBJECTS ---- ");
m: printf("\n\n\t\t\tMATH : ");
scanf("%f",&mark1);
if(mark1<0||mark1>100){
printf("\n\n\t\tMARKS SHOULD BE IN 0-100");
goto m;
}
p: printf("\n\n\t\t\tPHYSICS : ");
scanf("%f",&mark2);
if(mark2<0||mark2>100){
printf("\n\n\t\tMARKS SHOULD BE IN 0-100");
goto p;
}
c: printf("\n\n\t\t\tCHEMISTRY: ");
scanf("%f",&mark3);
if(mark3<0||mark3>100){
printf("\n\n\t\tMARKS SHOULD BE IN 0-100");
goto c;
}
e: printf("\n\n\t\t\tENGLISH : ");
scanf("%f",&mark4);
if(mark4<0||mark4>100){
printf("\n\n\t\tMARKS SHOULD BE IN 0-100");
goto e;
}
h: printf("\n\n\t\t\tHINDI : ");
scanf("%f",&mark5);
if(mark5<0||mark5>100){
printf("\n\n\t\tMARKS SHOULD BE IN 0-100");
goto h;
}
total=mark1+mark2+mark3+mark4+mark5;
avg=total/5;
printf("\n\n\n\t\t\tAGGRETE MARKS OF STUDENT : %.2f/500",total);
printf("\n\n\n\t\t\tAVERAGE MARKS OF STUDENT : %.2f %%",avg);
getch();
}
Download Files
Comments
Post a Comment