Write a C program using do while to find and print the average of three exam results of a student that will entered as an input from the keyboard. It repeats as many times as the user wishes. The program will ask for entering new entry (student grades) confirmation and if the user enters ‘N’ or ‘n’ as an input the program will stop entering new student results and will be terminated.
I managed to do it until here
#include <stdio.h>
#include <conio.h>
void main ()
{
int sum=0;
int r1,r2,r3;
float avg;
char ch;
printf("Enter the Marks of 1st Exam : ");
scanf("%d",&r1);
printf("Enter the Marks of 2nd Exam : ");
scanf("%d",&r2);
printf("Enter the Marks of 3rd Exam : ");
scanf("%d",&r3);
do
{
sum=r1+r2+r3;
avg=sum*1.0/3;
printf("The Avg is : %.2f",avg);
printf("\nEnter the Marks of 1st Exam : ");
scanf("%d",&r1);
printf("Enter the Marks of 2nd Exam : ");
scanf("%d",&r2);
printf("Enter the Marks of 3rd Exam : ");
scanf("%d",&r3);
}
while(ch=='n'||ch=='N');
printf("The Avg is : %.2f",avg);
getche();
}
thanks