{-='Ask for the Student Name & Compute the grade using Dev-C LaNGuaGe'=-}
Ask for the Student Name & Compute the grade
#include<stdio.h>
int main (void)
{
// Local Declarations
char name[25];
char subjct[20];
int grade1,grade2,grade3,sum,avecompt;
int count,ask;
float ave,totalave;
// Statements
printf("\a");
printf("Enter Student Name:");
scanf("%s",&name);
printf("\nEnter how many subject would you like to compute:");
scanf("%i",&ask);
printf("\nStudent Name: %s",name);
for(count = 0;count < ask;count++)
{
printf("\nEnter a Subject:");
scanf("%s",&subjct);
printf("First Grade:");
scanf("%i",&grade1);
printf("Second Grade:");
scanf("%i",&grade2);
printf("Third Grade:");
scanf("%i",&grade3);
printf("\n\n\t1st Grade:" "%i",grade1);
printf("\t2nd Grade:" "%i",grade2);
printf("\t3rd Grade:" "%i",grade3);
printf("\n");
printf("\t============\t=============\t============");
sum = grade1 + grade2 + grade3;
ave = sum / 3;
printf("\n\n\nyour Average is:%f",ave);
printf("\n\n\n\n\n\n");
}// for
return 0;
system("pause");
}// main
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.