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 times 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 <= 100) 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);

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

How to fix this zeros?? 

Here's the code!

#include<stdio.h>
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 times
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 <= 100)
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
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
Transcribed Image 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
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Functions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education