Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

LAB 11

#include <stdio.h>

void main(void)
{
int k;
extern float compMarks[];
float total;
char grade;
total=0;
printf("The values in the data file are:");
for(k=0; k<7; k++)
{
printf("%5.1f", compMarks[k]);
}
k=0;
for(k=0;k<7;k++)
{
total=total+compMarks[k];
}
if(total<50)
grade='F';
else if(total<60)
grade='D';
else if(total<70)
grade='C';
else if(total<80)
grade='B';
else(grade='A');

printf("\nYour total marks are %.2f, and your grade


is %c.\n", total, grade);
}

You might also like