C De Bir Sınıftaki Öğrencilerin Not Ortalamalarını Hesaplama

C De Bir Sınıftaki Öğrencilerin Not Ortalamaları Nasıl Hesaplanır?

#include <stdio.h>

int main(void){
unsigned int counter;
int grade;
int total;
int average;

total = 0;
counter = 1;

while(counter<=5){
printf(“%s”, “Enter grade: “);
scanf(“%d”, &grade);
if(grade>100){
printf(“Number can not be grater than 100”);
}else{
if(grade<0){
printf(“Number can not be smaller than 0”);
}else{
total += grade;
counter += 1;
}
}
average = total/5;
printf(“Average note of the class is %d”, average);
}

Leave a Reply

Your email address will not be published. Required fields are marked *