-
Notifications
You must be signed in to change notification settings - Fork 0
/
3.c
42 lines (34 loc) · 912 Bytes
/
3.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <stdio.h>
struct books
{
char title[50];
char author[50];
char subject[100];
int book_id;
};
int main()
{
struct books bookArray[5];
printf("Enter Details Of Five Books:\n");
for (int i = 0; i < 5; i++)
{
printf("Book %d:\n", i + 1);
printf("Title:");
scanf("%s", bookArray[i].title);
printf("Author:");
scanf("%s", bookArray[i].author);
printf("Subject:");
scanf("%s", bookArray[i].subject);
printf("Book id:");
scanf("%d", &bookArray[i].book_id);
}
printf("Details of the five books entered by the user:\n");
for (int i = 0; i < 5; i++)
{
printf("Title:%s\n", bookArray[i].title);
printf("Author:%s\n", bookArray[i].author);
printf("Subject:%s\n", bookArray[i].subject);
printf("Book_id:%d\n", bookArray[i].book_id);
}
return 0;
}