C Program to Read and Display Data Using Structures

In this program, you'll learn to declare structure book having data member as book_name, bookid, book_price. Accept this data for 3 books and display it.

Source Code
struct book
    char book_name[20];
    int bookid;
    int book_price;

int main()
    int i;
        printf("Enter details for book %d :",i+1);
        scanf("%s %d %d", b[i].book_name,&b[i].bookid,&b[i].book_price);
    printf("\nDetails of books :\n");
        printf("%s %d %d\n", b[i].book_name,b[i].bookid,b[i].book_price);
Enter details for book 1 :PCI 101 300
Enter details for book 2 :BCC 102 350
Enter details for book 3 :WPD 103 250

Details of books :
PCI 101 300
BCC 102 350
WPD 103 250

"Coding Hub - Learn to code" app now available on Google Play Store