WRITE A PROGRAM TO ENTER THE DETAILS OF A BOOK USING STRUCTURE AND PRINT THEM.

Written by Sharad Raj on 13th of March, 2018

C LANGUAGE PROGRAMS   STRUCTURE PROGRAMS

PROGRAM CODE

#include<stdio.h>
#include<conio.h>
void main()
{
struct p
{
char title[20];
int price;
};
struct p book[10];
int i;
for(i=0;i<10;i++)
{
printf("Enter the title of BOOK %d : ",i+1);
scanf("%s",book[i].title);
printf("\nEnter the price : ");
scanf("%d",&book[i].price);
}
for(i=0;i<10;i++)
{

printf("\nBOOK NAME\t\tPRICE\n");
printf("%s\t\t%d\n",&book[i].title,book[i].price);
}
getch();

}