Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

how do i wrtie struture

+2 votes
asked 1 day ago by anonymous
Write a program with a struct Book (title, price). Create 2 books, scan them, print them using a void function called printBook.

1 Answer

0 votes
answered 1 day ago by Dhanu Atte (140 points)
#include<stdio.h>

struct Book

{

int price;

char title[20];

}

int main()
{

struct Book b1,b2;

printf("Enter book1 price:");

scanf("%d",&b1.price);

printf("Enter book1 title:");

scanf("%s",&b1.title);

printf("Enter book2 price:");

scanf("%d",&b2.price);

printf("Enter book2 title:");

scanf("%d",&b2.title);

printf("Book1 price:\nBook 1 title:\nBook2 price:\nBook2 title:",%d%s%d%s);
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and receive answers from other members of the community.
...