How to fix this zeros?? Here's the code! #include struct student //Defining structure { int id; char name[20]; float percentage; }; void main(){ //Program execution starts int n, passedCount = 0;...



How to fix this zeros??



Here's the code!


#include
struct student //Defining structure
{
int id;
char name[20];
float percentage;
};
void main(){ //Program execution starts
int n, passedCount = 0; //Variable for user input output
float highestGrade = 0; //variable for output highest score
printf("Enter Number of Records: ");
scanf("%d",&n); //user input number of students
struct student record[n]; //defining array of size n
for (int i = 0; i < n;="" i++){="" running="" loop="" n="">
printf("\nRecords of STUDENT: %d\n",i+1);
printf("ID: ");

scanf("%d",&record[i].id); //user input student id
printf("\nName: ");
scanf("%s",record[i].name); //user input student name
printf("\nPercentage: ");
scanf("%f",&record[i].percentage); //user input student percentage
//comparing entered percentage with already stored highest
if (record[i].percentage > highestGrade)
highestGrade = record[i].percentage;
//checking whether the student passed
if (record[i].percentage > 70 && record[i].percentage <=>
passedCount++;
}
//Displaying output
printf("\n\nHighest Grade: %f\n",highestGrade);
printf("Total No. of Passed: %d\n",passedCount);
//number of student failed = total - passed
printf("Total No. of Failed: %d\n",n-passedCount);
}




Look in the Expected Results in the Outputs!


LAST RUN on 3/28/2021, 1:12:30 AM<br>Check 1 failed<br>Output:<br>Enter Number of Records:<br>Records of STUDENT: 1<br>ID:<br>Name:<br>Percentage:<br>Records of STUDENT: 2<br>ID:<br>Name:<br>Percentage:<br>Records of STUDENT: 3<br>ID:<br>Name:<br>Percentage:<br>Highest Grade: 90.50000o<br>Total No. of Passed: 2<br>Total No. of Failed: 1<br>Expected:<br>Enter Number of Records:<br>Records of STUDENT: 1<br>ID:<br>Name:<br>Percentage:<br>Records of STUDENT: 2<br>ID:<br>Name:<br>Percentage:<br>Records of STUDENT: 3<br>ID:<br>Name:<br>Percentage:<br>Highest Grade: 90.50<br>Total No. of Passed: 2<br>Total No. of Failed: 1<br>Check 2 failed<br>Output:<br>Enter Number of Records:<br>Records of STUDENT: 1<br>ID:<br>Name:<br>Percentage:<br>Records of STUDENT: 2<br>ID:<br>Name:<br>Percentage:<br>Records of STUDENT: 3<br>ID:<br>Name:<br>Percentage:<br>Records of STUDENT: 4<br>ID:<br>Name:<br>Percentage:<br>Records of STUDENT: 5<br>ID:<br>Name:<br>Percentage:<br>Highest Grade: 99.750000<br>Total No. of Passed: 3<br>Expected:<br>Enter Number of Records:<br>Records of STUDENT: 1<br>ID:<br>Name:<br>Percentage:<br>Records of STUDENT: 2<br>ID:<br>Name:<br>Percentage:<br>Records of STUDENT: 3<br>ID:<br>Name:<br>Percentage:<br>Records of STUDENT: 4<br>ID:<br>Name:<br>Percentage:<br>Records of STUDENT: 5<br>ID:<br>Name:<br>Percentage:<br>Highest Grade: 99.75<br>Total No. of Passed: 3<br>Total No. of Failed: 2<br>

Extracted text: LAST RUN on 3/28/2021, 1:12:30 AM Check 1 failed Output: Enter Number of Records: Records of STUDENT: 1 ID: Name: Percentage: Records of STUDENT: 2 ID: Name: Percentage: Records of STUDENT: 3 ID: Name: Percentage: Highest Grade: 90.50000o Total No. of Passed: 2 Total No. of Failed: 1 Expected: Enter Number of Records: Records of STUDENT: 1 ID: Name: Percentage: Records of STUDENT: 2 ID: Name: Percentage: Records of STUDENT: 3 ID: Name: Percentage: Highest Grade: 90.50 Total No. of Passed: 2 Total No. of Failed: 1 Check 2 failed Output: Enter Number of Records: Records of STUDENT: 1 ID: Name: Percentage: Records of STUDENT: 2 ID: Name: Percentage: Records of STUDENT: 3 ID: Name: Percentage: Records of STUDENT: 4 ID: Name: Percentage: Records of STUDENT: 5 ID: Name: Percentage: Highest Grade: 99.750000 Total No. of Passed: 3 Expected: Enter Number of Records: Records of STUDENT: 1 ID: Name: Percentage: Records of STUDENT: 2 ID: Name: Percentage: Records of STUDENT: 3 ID: Name: Percentage: Records of STUDENT: 4 ID: Name: Percentage: Records of STUDENT: 5 ID: Name: Percentage: Highest Grade: 99.75 Total No. of Passed: 3 Total No. of Failed: 2
Jun 05, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here