Book Ex With Total Rate


            struct Book
            {
                char name[20];
                int pages, rate;
            };
        
            main()
            {
                struct Book b[5];
                int k, total = 0;
                clrscr();
        
                for(k = 0; k <= 2; k++)
                {
                    printf("Enter the Book Name : ");
                    scanf("%s", b[k].name);
        
                    printf("\n Enter the Book Page : ");
                    scanf("%d", &b[k].pages);
        
                    printf("\n Enter the Rate of Book : ");
                    scanf("%d", &b[k].rate);
                }
        
                printf("\n Name \t Pages \tRate");
        
                for(k = 0; k <= 2; k++)
                {
                    printf("\n %s", b[k].name);
                    printf("\t %d", b[k].pages);
                    printf("\t %d", b[k].rate);
                    total = total + b[k].rate;
                }
        
                printf("\n total of books rate is %d", total);
        
                getch();
            }
        

Output: