bsc

Comprehensive codebase and cou...
Log | Files | Refs | README | LICENSE

APC-S-014.c (965B)


      1 /*
      2  * Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 14 Jan 2026
      3  * Repo: https://github.com/notamitgamer/bsc
      4  * License: MIT
      5  */
      6 
      7 /* Write a program to store roll no, name and marks of 5 students then print it. use structure */
      8 
      9 #include <stdio.h>
     10 #include <string.h>
     11 
     12 struct student
     13 {
     14     int roll_no;
     15     char name[30];
     16     float marks;
     17 };
     18 
     19 int main()
     20 {
     21     int i, stu_count = 3;
     22     struct student s[stu_count];
     23     for (i = 0; i < stu_count; i++)
     24     {
     25         printf("\nEnter the Roll Number: ");
     26         scanf("%d", &s[i].roll_no);
     27         getchar();
     28         printf("Enter the name: ");
     29         gets(s[i].name);
     30         printf("Enter the Marks: ");
     31         scanf("%f", &s[i].marks);
     32     }
     33     printf("\n%-10s %-20s %-10s\n", "ROLL", "NAME", "MARKS");
     34     printf("%-10s %-20s %-10s\n", "====", "====", "=====");
     35     for (i = 0; i < stu_count; i++)
     36     {
     37         printf("%-10d %-20s %-10.2f\n", s[i].roll_no, s[i].name, s[i].marks);
     38     }
     39     return 0;
     40 }
© notamitgamer • Site Built: 2026-07-21 13:58:23 UTC • git-mirror commit: 1037f62 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror