Please help how to fix my code?
My code!
#include
struct Student
{
int id;
char name[30];
float percent;
};
int main() {
struct Student s[3];
for(int i=0;i<>
{
scanf("%d",&s[i].id);
scanf("%s",s[i].name);
scanf("%f",&s[i].percent);
}
for(int i=0;i<>
{
printf("Records of Student %d",i+1);
printf("\nID :%d",s[i].id);
printf("\nName: %s",s[i].name);
printf("\nPercentage :%.2f",s[i].percent);
printf("\n");
}
return 0;
}
Extracted text: #include 2 LAST RUN on 3/27/2021, 9:10:14 PM Check 1 failed 4 struct Student Output: 5- { Records of Student 1 7 int id; ID :1 char name [30]; Name: Naruto float percent; Percentage :86.50 10 }; 11 Records of Student 2 12 - int main() { ID :2 13 Name: Luffy 14 struct Student s[3]; 15 Percentage :90.50 for (int i=0;i<3;i++) 16="" records="" of="" student="" 3="" 17="" {="" scanf="" ("%d",="" &s[i].id);="" scanf="" ("%s",s[1].name);="" scanf="" ("%f",&s[i].percent);="" id="" :3="" 18="" name:="" goku="" 19="" 20="" percentage="" :81.00="" 21="" }="" expected:="" 22="" records="" of="" student:="" 1="" for="" (int="" i="">3;i++)><3;i++) 23="" id:="" {="" printf("records="" of="" student="" %d",i+l);="" printf("\nid="" :%d",s[i].id);="" printf("\nname:="" %s",s[i].name);="" printf("\npercentage="" :%.2f",s[i].percent);="" printf("\n");="" }="" 24="" -="" 25="" name:="" 26="" percentage:="" 27="" records="" of="" student:="" 2="" 28="" 29="" id:="" 30="" name:="" 31="" return="" 0;="" percentage:="" 32="" }="" records="" of="" student:="" 3="" id:="" name:="" percentage:="" check="" 2="" failed="" output:="" records="" of="" student="" 1="" id="" :1="" name:="" bulbasaur="" percentage="" :80.00="" records="" of="" student="" 2="" id="" :2="" name:="" squirtle="" percentage="" :90.00="" records="" of="" student="" 3="" id="" :3="" name:="" charmander="" percentage="" :100.00="" expected:="" 78%="" (25:16)="" records="" of="" student:="">3;i++)>
Extracted text: #include Name: Goku Percentage :81.00 3 Expected: 4 struct Student { Records of STUDENT: 1 ID: 7 int id; Name: char name [30]; float percent; 8 Percentage: 10 }; Records of STUDENT: 2 11 ID: 12 int main() { Name: 13 14 struct Student s[3]; Percentage: 15 Records of STUDENT: 3 for (int i=0;i<3;i++) 16="" id:="" {="" scanf="" ("%d",="" &s[i].id);="" scanf="" ("%s",s[i].name);="" scanf="" ("%f",&s="" [i].percent);="" 17="" -="" name:="" 18="" 19="" percentage:="" 20="" check="" 2="" failed="" 21="" }="" output:="" 22="" for="" (int="" i="">3;i++)><3;i++) records of student 1 23 { printf("records of student %d",i+1); pri printf("\nname: %s",s[i].name); printf("\npercentage :%.2f",s[i].percent); printf("\n"); 24 - id :1 25 name: bulbasaur 26 s[i].id) percentage :80.00 27 28 records of student 2 29 id :2 30 name: squirtle 31 return 0; } percentage :90.00 32 records of student 3 id :3 name: charmander percentage :100.00 expected: records of student: 1 id: name: percentage: records of student: 2 id: name: percentage: records of student: 3 id: name: percentage: show diff 78% (25:16) records="" of="" student="" 1="" 23="" {="" printf("records="" of="" student="" %d",i+1);="" pri="" printf("\nname:="" %s",s[i].name);="" printf("\npercentage="" :%.2f",s[i].percent);="" printf("\n");="" 24="" -="" id="" :1="" 25="" name:="" bulbasaur="" 26="" s[i].id)="" percentage="" :80.00="" 27="" 28="" records="" of="" student="" 2="" 29="" id="" :2="" 30="" name:="" squirtle="" 31="" return="" 0;="" }="" percentage="" :90.00="" 32="" records="" of="" student="" 3="" id="" :3="" name:="" charmander="" percentage="" :100.00="" expected:="" records="" of="" student:="" 1="" id:="" name:="" percentage:="" records="" of="" student:="" 2="" id:="" name:="" percentage:="" records="" of="" student:="" 3="" id:="" name:="" percentage:="" show="" diff="" 78%="">3;i++) records of student 1 23 { printf("records of student %d",i+1); pri printf("\nname: %s",s[i].name); printf("\npercentage :%.2f",s[i].percent); printf("\n"); 24 - id :1 25 name: bulbasaur 26 s[i].id) percentage :80.00 27 28 records of student 2 29 id :2 30 name: squirtle 31 return 0; } percentage :90.00 32 records of student 3 id :3 name: charmander percentage :100.00 expected: records of student: 1 id: name: percentage: records of student: 2 id: name: percentage: records of student: 3 id: name: percentage: show diff 78% (25:16)>