EmbLogic's Blog

Record maintained using structure

1#include <stdio.h>
2 struct student
3 {
4        char name[50];
5            int roll;
6                float marks;
7 };
8 int main()
9 {
10 {
11         printf(“===========================================\n”);
12         printf(”                menu                       \n”);
13         printf(“===========================================\n”);
14         printf(“1.add student record\n”);
15         printf(“2.delete student record\n”);
16         printf(“3.update student record\n”);
17         printf(“4.view all student record\n”);
18 }
19
20 {
21   struct student s[10];
22    int i;
23   printf(“Enter information of students:\n”);
24  for(i=0;i<10;++i)
25   {
26      s[i].roll=i+1;
27      printf(“\nFor roll number %d\n”,s[i].roll);
28      printf(“Enter name: “);

29      scanf(“%s”,s[i].name);
30      printf(“Enter marks: “);
31      scanf(“%f”,&s[i].marks);
32      printf(“\n”);
33
34       }
35     printf(“Displaying information of students:\n\n”);
36     for(i=0;i<10;++i)
37    printf(“\nInformation for roll number %d:\n”,i+1);
38     printf(“Name: “);
39     puts(s[i].name);
40    printf(“Marks: %.1f”,s[i].marks);
41
42 }  return 0;
43 }

note:- till date output is

enter roll no

enter student name

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>