1 of 2 1. Write a C program that stores the scores of 5 students in an array and prints their individual grades. (A > 85, B > 70, C > 60, F <= 50).
Sun Aug 20 2023 13:07:21 GMT+0000 (Coordinated Universal Time)
Saved by
@Codes
// Online C compiler to run C program online
#include <stdio.h>
int main() {
int size = 5;
int a[size];
for(int i = 0;i < size;i++){
printf("Student - %d: ",i+1);
scanf("%d",&a[i]);
}
for(int i =0;i < size;i++){
if(a[i]>85){
a[i] = 'A';
}
else if(a[i]>70){
a[i] = 'B';
}
else if(a[i]>60){
a[i] = 'C';
}
else if(a[i]<=50){
a[i] = 'F';
}
}
for(int i = 0; i < size; i++){
printf("%c",a[i]);
}
return 0;
}
content_copyCOPY
Comments