10. (A) Programs on structures.

10. (A) Programs on structures.
Programs on structures.


  1. #include <stdio.h>
  2. struct student {
  3. char name[50];
  4. int roll;
  5. float marks;
  6. } s;
  7. int main() {
  8. printf("Enter information:\n");
  9. printf("Enter name: ");
  10. fgets(s.name, sizeof(s.name), stdin);
  11. printf("Enter roll number: ");
  12. scanf("%d", &s.roll);
  13. printf("Enter marks: ");
  14. scanf("%f", &s.marks);
  15. printf("Displaying Information:\n");
  16. printf("Name: ");
  17. printf("%s", s.name);
  18. printf("Roll number: %d\n", s.roll);
  19. printf("Marks: %.1f\n", s.marks);
  20. return 0;
  21. }
10. (A) Programs on structures. 10. (A) Programs on structures. Reviewed by admin on December 23, 2019 Rating: 5

No comments:

Powered by Blogger.