21. Display name of book,pages and price using array of structure.


Comments

  1. /* program to accept multiple values of book using ARRAY OF STRUCT */

    #include

    void main()
    {
    int i;
    struct book
    {
    char name[100];
    float price;
    int pages;
    }b[5];

    for(i=0;i<=4;i++)
    {
    printf("\nEnter the name of book...");
    scanf("%s",b[i].name);

    printf("Enter the price of book...");
    scanf("%f",&b[i].price);

    printf("ENter the pages of book....");
    scanf("%d",&b[i].pages);
    }

    for(i=0;i<=4;i++)
    {
    printf("\nNAME=%s \nPRICE=%f \nPAGES=%d\n\n",b[i].name,b[i].price,b[i].pages);
    }
    }

    ReplyDelete
  2. Akshay Sidwadkar12:30 PM

    /* program to accept multiple values of book using ARRAY OF STRUCT */

    #include

    void main()
    {
    int i;
    struct book
    {
    char name[100];
    float price;
    int pages;
    }b[5];

    for(i=0;i<=4;i++)
    {
    printf("\nEnter the name of book...");
    scanf("%s",b[i].name);

    printf("Enter the price of book...");
    scanf("%f",&b[i].price);

    printf("ENter the pages of book....");
    scanf("%d",&b[i].pages);
    }

    for(i=0;i<=4;i++)
    {
    printf("\nNAME=%s \nPRICE=%f \nPAGES=%d\n\n",b[i].name,b[i].price,b[i].pages);
    }
    }

    ReplyDelete
    Replies
    1. puja khandare9:09 AM

      #include
      void main()
      {
      int i;
      struct book
      {
      char name[100];
      float price;
      int pages;
      }b[5];

      for(i=0;i<=4;i++)
      {
      printf("\nEnter the name of book...");
      scanf("%s",b[i].name);

      printf("Enter the price of book...");
      scanf("%f",&b[i].price);

      printf("ENter the pages of book....");
      scanf("%d",&b[i].pages);
      }

      for(i=0;i<=4;i++)
      {
      printf("\nNAME=%s \nPRICE=%f \nPAGES=%d\n\n",b[i].name,b[i].price,b[i].pages);
      }
      }

      Delete
    2. mayuri magar10:30 AM

      #include
      void main()
      {
      struct employee
      {
      char n[20],mail[20];
      int sal,contact;
      }e;
      printf("\n\tEnter name,contact no,salary and mail id of employee:\n\t");
      scanf("%s%d%d%s",e.n,&e.contact,&e.sal,e.mail);
      printf("\n\tEmployee Details are:\n\t1.NAME=%s \n\t2.CONTACT NO.=%d \n\t3.SALARY=%d \n\t4.MAIL ID=%s",e.n,e.contact,e.sal,e.mail);
      }

      Delete
  3. Mubin Pirjade8:54 AM

    well arranged,correct and stylish program lies here only!!
    #include
    struct book
    {
    char name[20];
    int pages;
    float price;
    }b[100];

    void main()
    {
    int n,i;
    printf("\n\nenter the number of books\n");
    scanf("%d",&n);
    for(i=0;i<=n-1;i++)
    {
    printf("\nEnter no. of pages\n ");
    scanf("%d",&b[i].pages);
    printf("\nenter the name of book\n");
    scanf("%s",b[i].name);
    printf("\nEnter price of book\n ");
    scanf("%f",&b[i].price);

    }

    printf("name\tpages\tprice\n");
    printf("------------------------------\n");
    for(i=0;i<=n-1;i++)
    {
    printf("\n%s\t%d\t%f\t",b[i].name,b[i].pages,b[i].price);
    }
    }

    ReplyDelete
  4. Radha Ghadge SE 2310:12 AM

    #include
    void main()
    {
    struct book
    {
    char name[20];
    int pages;
    float price;
    }b;
    printf("\n enter the book name=");
    scanf("%s",&b.name);
    printf("\n enter the pages=");
    scanf("%d",&b.pages);
    printf("\n enter the price=");
    scanf("%f",&b.price);

    printf("\n name=%s",b.name);
    printf("\n pages=%d",b.pages);
    printf("\n price=%f",b.price);
    }




    ReplyDelete
  5. Swati Waghmare10:36 AM

    /*To display the information of book using array of stucture*/
    #include
    void main()
    {
    int i;
    struct book
    {
    char name[100];
    float price;
    int pages;
    }b[5];

    for(i=0;i<=4;i++)
    {
    printf("\n\tEnter the name of book");
    scanf("%s",b[i].name);

    printf("\n\tEnter the price of book");
    scanf("%f",&b[i].price);

    printf("\n\tEnter the pages of book");
    scanf("%d",&b[i].pages);
    }

    for(i=0;i<=4;i++)
    {
    printf("\n\tNAME=%s \n\tPRICE=%f \n\tPAGES=%d",b[i].name,b[i].price,b[i].pages);
    }
    }

    ReplyDelete
  6. lengarepooja3:59 PM

    #include

    void main()
    {
    struct book
    {

    char name[50];
    float price;
    int pages;
    }b[10];
    int i=0;
    for(i=0;i<=9;i++)
    {
    printf("\nEnter the name of book:");
    scanf("%s",b[i].name);
    printf("\nEnter the price of book:");
    scanf("%f",&b[i].price);
    printf("\nEnter the no.of pages:");
    scanf("%d",&b[i].pages);

    }
    for(i=0;i<=9;i++)
    {
    printf("\nName of Book:%s\nPrice of book:%f\nPages:%d\n",b[i].name,b[i].price,b[i].pages);
    }
    }

    ReplyDelete
  7. /* display the 10 books information*/
    #include

    void main()
    {
    struct book
    {
    char name[10];
    float price;
    int pages;

    }b[10];
    int i;
    for(i=0;i<=9;i++)
    {


    printf("\nenter name of book=");
    scanf("%s",b[i].name);

    printf("enter price of book=");
    scanf("%f",&b[i].price);

    printf("enter pages of book=");
    scanf("%d",&b[i].pages);
    }
    for(i=0;i<=9;i++)
    {

    printf("\nbook name=%s,\nbook price=%f,\nbook pages=%d",b[i].name,b[i].price,b[i].pages);

    }
    }

    ReplyDelete
  8. #include
    void main()
    {
    int i;
    struct Book
    {
    char name[2];

    float price;
    int pages;
    }b[2];
    for(i=0;i<2;i++)
    {
    printf("\nEnter the Name, Price,Pages of book \n");
    scanf("%s%f%d",b[i].name,&b[i].price,&b[i].pages);

    }
    for(i=0;i<2;i++)
    {
    printf("\nName=%s\nPrice=%f\nPages=%d\n",b[i].name,b[i].price,b[i].pages);
    }
    }

    ReplyDelete
  9. Sayali Daunde12:53 PM

    // display name,pages,price of book
    #include
    void main()
    {
    int i;

    struct book
    {
    char name[200];
    int pages;
    float price;
    }x[5];
    for(i=0;i<=4;i++)
    {
    printf("\n\t Enter the name of book=");
    scanf("%s",x[i].name);
    printf("\n\t Enter the pages of book=");
    scanf("%d",&x[i].pages);
    printf("\n\t Enter the price of book=");
    scanf("%f",&x[i].price);
    }
    for(i=0;i<=4;i++)
    {
    printf("\n\tname=%s,\n\tpages=%d,\n\tprice=%f",x[i].name,x[i].pages,x[i].price);
    }
    }

    ReplyDelete
  10. sanjivani atakare4:46 PM

    #include
    void main()
    {
    struct book1
    {
    char name[10];
    float price;
    int pages;
    }b[10];
    int i;
    for(i=0;i<=9;i++)
    {
    printf("\n\tEnter the name of boot\n\t");
    scanf("%s",b[i].name);
    printf("\n\tEnter the price of book\n\t");
    scanf("%f",&b[i].price);
    printf("\n\tEnter the pages of book\n\t");
    scanf("%d",&b[i].pages);
    }
    for(i=0;i<=9;i++)
    {
    printf("\n\tBook Name=%s\n\tBook Price=%f\n\tBook Pages=%d",b[i].name,b[i].price,b[i].pages);
    }
    }

    ReplyDelete
  11. Pallavi Bagal5:21 PM

    #include

    void main()
    {
    struct book
    {

    char name[50];
    float price;
    int pages;
    }b[10];
    int i=0;
    for(i=0;i<=9;i++)
    {
    printf("\nEnter the name of book:");
    scanf("%s",b[i].name);
    printf("\nEnter the price of book:");
    scanf("%f",&b[i].price);
    printf("\nEnter the no.of pages:");
    scanf("%d",&b[i].pages);

    }
    for(i=0;i<=9;i++)
    {
    printf("\nName of Book:%s\nPrice of book:%f\nPages:%d\n",b[i].name,b[i].price,b[i].pages);
    }
    }

    ReplyDelete
  12. // Using array of structure display details of 5 books
    #include
    #include
    void main()
    {
    int i;
    struct book
    {
    char name[20];
    float price;
    int page;
    }b[5];
    for(i=0;i<=4;i++)
    {
    printf("\n Enter name of book=");
    scanf("%s",b[i].name);
    printf("\n Enter price of book=");
    scanf("%f",&b[i].price);
    printf("\n Enter pages in book=");
    scanf("%d",&b[i].page);

    }
    for(i=0;i<=4;i++)
    {
    printf(" \n Name of book =%s \t Price of book=%f \t Pages in book=%d \t",b[i].name,b[i].price,b[i].page);
    }
    }

    ReplyDelete
  13. sushma jadhav11:36 AM

    //Book strcture
    #include
    void main()
    {
    struct book
    {
    char name[10];
    int pages;
    float price;
    }b[5];
    int i;
    for(i=0;i<=4;i++)
    {
    printf("Enter name\n pages \n price");
    scanf("\n%s\n%d\n%f",b[i].name,&b[i].pages,&b[i].price);
    printf("nane=%s \npages=%d \nprice=%f",b[i].name,b[i].pages,b[i].price);
    }


    }

    ReplyDelete
  14. Dipali Kore12:01 PM

    //display info of book using array
    #include
    void main()
    {

    struct book
    {
    char name[10];
    float price;
    int pages;
    }b[5];
    int i;
    for(i=0;i<=4;i++)
    {
    printf("\nenter the name of book");
    scanf("%s",b[i].name);
    printf("\nenter the price of book");
    scanf("%f",&b[i].price);
    printf("\nenter the pages of book");
    scanf("%d",&b[i].pages);
    }
    for(i=0;i<=4;i++)
    {
    printf("\nname=%s,price=%f,pages=%d",b[i].name,b[i].price,b[i].pages);
    }
    }

    ReplyDelete
  15. Bhosale Dhanashri SE312:15 PM

    //program of displaying structure of book by using array



    #include

    void main()
    {
    int i;
    struct book
    {
    char name[10];
    float price;
    int pages;
    }b[5];

    for(i=1;i<=5;i++)
    {
    printf("\n Enter the name of the book::\n");
    scanf("%s",b[i].name);

    printf("\n Enter the price of the book::\n");
    scanf("%f",&b[i].price);

    printf("\n Enter the no of pages of the book::\n");
    scanf("%d",&b[i].pages);
    }
    for(i=1;i<=5;i++)
    {

    printf("\n The name of the book::%s \n The price of book::%f \n The no of pagesof book::%d \n\n" ,b[i].name,b[i].price,b[i].pages);

    }

    }

    ReplyDelete
  16. poonam pusavale12:17 PM

    /*display name,price,pages of book using array of structure*/
    #include
    void main()
    {
    struct book
    {
    char name[10];
    float price;
    int pages;
    }b[5];
    int i;
    for(i=0;i<=4;i++)
    {
    printf("\n\t enter name of book");
    scanf("%s",b[i].name);
    printf("\n\t enter price of book");
    scanf("%f",&b[i].price);
    printf("\n\t enter pages of book");
    scanf("%d",&b[i].pages);
    }
    for(i=0;i<=4;i++)
    {
    printf("\n\t name=%s \n\t price=%f \n\t pages=%d",b[i].name,b[i].price,b[i].pages);
    }
    }

    ReplyDelete
  17. Bhanvase Yashoda12:24 PM

    /* structure of book by array of struct*/
    #include
    void main()
    {
    int i;
    struct book
    {
    char name[10];
    int pages;
    float price;
    }b[10];

    for(i=0;i<=9;i++)
    {
    printf("\n\t enter name");
    scanf("%s",b[i].name);
    printf("\n\t enter pages");
    scanf("%d",&b[i].pages);
    printf("\n\t enter price");
    scanf("%f",&b[i].price);
    }

    for(i=0;i<=9;i++)
    {

    printf("name=%spages=%dprice=%f",b[i].name,b[i].pages,b[i].price);

    }
    }









    ReplyDelete
  18. #include
    void main()
    {int i;
    struct book
    {
    char name[20];
    float price;
    int pages;
    }p[5];
    for(i=0;i<=4;i++)
    {
    printf("\nBook name=");
    scanf("%s",p[i].name);
    printf("\tPrice=");
    scanf("%f",&p[i].price);
    printf("\tenter no of pages=");
    scanf("%d",&p[i].pages);
    }
    for(i=0;i<=4;i++)
    {printf("Book name=%s",p[i].name);
    printf("\tprice=%f\tpages=%d\n",p[i].price,p[i].pages);
    }
    }

    ReplyDelete
  19. sonali nagane12:32 PM

    #include
    void main()
    {
    struct book
    {
    char name[10];
    float price;
    int pages;
    }b;
    {printf("\n enter the name of book");
    scanf("%s",b.name);
    printf("\n enter the price of book");
    scanf("\%f",&b.price);
    printf("\n enter the pages of book");
    scanf("\%d",&b.pages);
    printf("\n\t book name=%s,book price=%f,book pages=%d",b.name,b.price,b.pages);
    }
    }




    ReplyDelete
  20. sushmita swami9:23 AM

    #include
    void main()
    {
    struct book
    {
    char name[20];
    int pages;
    float price;
    }b;
    printf("\n enter the book name=");
    scanf("%s",&b.name);
    printf("\n enter the pages=");
    scanf("%d",&b.pages);
    printf("\n enter the price=");
    scanf("%f",&b.price);

    printf("\n name=%s",b.name);
    printf("\n pages=%d",b.pages);
    printf("\n price=%f",b.price);
    }

    ReplyDelete
  21. Bhanvase Yashoda10:03 AM

    /* structure of book by array of struct*/
    #include
    void main()
    {
    int i;
    struct book
    {
    char name[10];
    int pages;
    float price;
    }b[10];

    for(i=0;i<=9;i++)
    {
    printf("\n\t enter name");
    scanf("%s",b[i].name);
    printf("\n\t enter pages");
    scanf("%d",&b[i].pages);
    printf("\n\t enter price");
    scanf("%f",&b[i].price);
    }

    for(i=0;i<=9;i++)
    {

    printf("name=%spages=%dprice=%f",b[i].name,b[i].pages,b[i].price);

    }
    }









    ReplyDelete
  22. rajashree bhosale SE444:53 PM

    #include
    void main()
    {
    struct Book
    {

    char Name[10];
    float price;
    int page;
    }b;

    printf("\n enter name of book");
    scanf("\n%s",b.Name);
    printf("\n enter price of book");
    scanf("\t%f",&b.price);
    printf("\nenter page of book");
    scanf("\t%d",&b.page);

    printf("\nbook name=%s\t book price=%f\t book page=%d",b.Name,b.price,b.page);
    }

    ReplyDelete
  23. madhu pujari5:18 PM

    #include
    void main()
    {
    int i;
    struct book
    {
    int pages;
    float price;
    char name[10];
    }b[10];
    for(i=0;i<10;i++)
    {
    printf("Enter the name");
    scanf("\n%s",b[i].name);
    printf("Enter the price");
    scanf("\n%f",&b[i].price);
    printf("Enter the pages");
    scanf("\n%d",&b[i].pages);
    }
    for(i=0;i<10;i++)
    {
    printf("\nName of book=%s\nprice of book=%f\npages of book=%d\n",b[i].name,b[i].price,b[i].pages);
    }

    }

    ReplyDelete
  24. Ranjit kalubarme12:01 PM

    #include
    void main()
    {
    int i;
    struct book
    {
    int pages;
    float price;
    char name[10];
    }b[10];
    for(i=0;i<10;i++)
    {
    printf("Enter the name");
    scanf("\n%s",b[i].name);
    printf("Enter the price");
    scanf("\n%f",&b[i].price);
    printf("Enter the pages");
    scanf("\n%d",&b[i].pages);
    }
    for(i=0;i<10;i++)
    {
    printf("\nName of book=%s\nprice of book=%f\npages of book=%d\n",b[i].name,b[i].price,b[i].pages);
    }

    }

    ReplyDelete
  25. Awate Snehal11:00 AM

    /*array of structure*/
    #include
    void main()
    {
    struct book
    {
    char name[20];
    int price;
    int pages;
    }b[10];
    int i;
    for(i=0;i<9;i++)
    {
    printf("\n enter name");
    scanf("%s",b[i].name);
    printf("\n enter price");
    scanf("%d",&b[i].price);
    printf("\n enter pages");
    scanf("%d",&b[i].pages);
    }
    for(i=0;i<9;i++)
    {
    printf("\n\t name=%s price=%d pages=%d",b[i].name,b[i].price,b[i].pages);
    }
    }

    ReplyDelete
  26. sachita jadhav11:33 AM

    #include
    void main()
    {
    struct book
    {
    char name[20];
    float price;
    int pages:
    }b[5];
    int i;
    for(i=0;i<=4;i++)
    {
    printf("\n\tenter name of book");
    scanf("%s",b[i].name);
    printf("\n enter price");
    scanf("%f",&b[i].price);
    printf("\n enter pages");
    scanf("%d",&b[i].pages);
    }
    for(i=0;i<=4;i++)
    {
    printf("\n\tname=%s \n\tprice=%f \n\tpages=%d",b[i].name,b[i].price,b[i].pages);
    }
    }

    ReplyDelete

Post a Comment