How to fix this zeros??
Here's the code!
#includestruct student //Defining structure{int id;char name[20];float percentage;};void main(){ //Program execution startsint n, passedCount = 0; //Variable for user input outputfloat highestGrade = 0; //variable for output highest scoreprintf("Enter Number of Records: ");scanf("%d",&n); //user input number of studentsstruct student record[n]; //defining array of size nfor (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 idprintf("\nName: ");scanf("%s",record[i].name); //user input student nameprintf("\nPercentage: ");scanf("%f",&record[i].percentage); //user input student percentage//comparing entered percentage with already stored highestif (record[i].percentage > highestGrade)highestGrade = record[i].percentage;//checking whether the student passedif (record[i].percentage > 70 && record[i].percentage <=>=>passedCount++;}//Displaying outputprintf("\n\nHighest Grade: %f\n",highestGrade);printf("Total No. of Passed: %d\n",passedCount);//number of student failed = total - passedprintf("Total No. of Failed: %d\n",n-passedCount);}Look in the Expected Results in the Outputs!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
Look in the Expected Results in the Outputs!
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here