Friday, 28 May 2021

Create a structure Book with entities - bname,aname,page,price.Input data for 10 books .Print the detail of the book with highest page number.

Create a structure Book with entities - book name, author name, page, price.

Input data for 10 books. Print the detail of the book with the highest page number.






#include <stdio.h>
#include <conio.h>
#include <string.h>


/*Structure define*/
struct bookList
{
    char bookName[20];
    char authorName[20];
    int page;
    float price;
};

int main()
{
    int numberijmax = 0;
A1:
    printf("\nEnter Number Of Books : ");
    scanf("%d", &number);

    if (number < 2)
    {
        printf("!!!   Enter Minimum 2 Number   !!!");
        goto A1;
    }

    struct bookList book[number];
    for (i = 0i < numberi++)
    {

        printf("\nEnter  book name : ");
        scanf("%s", &book[i].bookName);
        printf("Auther Name : ");
        scanf("%s", &book[i].authorName);
        printf("Pages In The Book : ");
        scanf("%d", &book[i].page);
        printf("Price Of The Book : ");
        scanf("%f", &book[i].price);
    }

    for (i = 0i < numberi++)
    {
        if (book[i].page > book[max].page)
        {
            max = i;
        }
    }
    printf("\n%s - book has maximum number of page %d . Written by %s And the price is %.0f"book[max].bookNamebook[max].pagebook[max].authorNamebook[max].price);

    return 0;
}




Output:



Share:

Related Posts:

0 comments:

Post a Comment