fork download
  1. #include <stdio.h>
  2.  
  3. struct Student {
  4. int roll;
  5. char name[50];
  6. float marks;
  7. };
  8.  
  9. int main() {
  10. struct Student students[10];
  11.  
  12. // Input student information
  13. printf("Enter information of 10 students:\n");
  14. for (int i = 0; i < 10; i++) {
  15. printf("Enter roll number of student %d: ", i+1);
  16. scanf("%d", &students[i].roll);
  17. printf("Enter name of student %d: ", i+1);
  18. scanf("%s", students[i].name);
  19. printf("Enter marks of student %d: ", i+1);
  20. scanf("%f", &students[i].marks);
  21. }
  22.  
  23. // Displaying student information
  24. printf("\nDisplaying information of 10 students:\n");
  25. for (int i = 0; i < 10; i++) {
  26. printf("Roll Number: %d\n", students[i].roll);
  27. printf("Name: %s\n", students[i].name);
  28. printf("Marks: %.2f\n", students[i].marks);
  29. printf("\n");
  30. }
  31.  
  32. return 0;
  33. }
Success #stdin #stdout #stderr 0.01s 5276KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Error: near line 3: near "struct": syntax error
Error: near line 5: near "char": syntax error
Error: near line 6: near "float": syntax error
Error: near line 7: unrecognized token: "}"
Error: near line 9: near "int": syntax error
Error: near line 12: near "/": syntax error
Error: near line 14: near "for": syntax error
Error: near line 16: near "scanf": syntax error
Error: near line 17: near "printf": syntax error
Error: near line 18: near "scanf": syntax error
Error: near line 19: near "printf": syntax error
Error: near line 20: near "scanf": syntax error
Error: near line 21: unrecognized token: "}"
Error: near line 25: near "for": syntax error
Error: near line 27: near "printf": syntax error
Error: near line 28: near "printf": syntax error
Error: near line 29: near "printf": syntax error
Error: near line 30: unrecognized token: "}"
Error: near line 33: unrecognized token: "}"