Monday, 4 July 2011

CALCULATING TOTAL AND AVERAGE OF MARKS





/* CALCULATING TOTAL AND AVERAGE OF MARKS */ /*comment*/

#include /*header files*/
main() /*program begins*/
{
int MARKS[6];
int i, TOTAL=0,AVG;
float avg;
for(i=0;i<6;i++)
{
printf("\n ENTER MARKS IN SUBJECT %i=", i+1);
scanf("%d",& MARKS[i]);
TOTAL +=MARKS[i];
}
printf("\n TOTAL MARKS =%d", TOTAL);
AVG=TOTAL/6;
printf("\n AVERAGE= %2f", AVG);
}

/*copy the same in ur c programming window and press alt+f5 for output*/

No comments:

Post a Comment