Tech
Forums
Jobs
Books
Events
Videos
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
1
Answer
Where is the problem in this code?
Md Nayeem
6y
179
1
Reply
#include <stdio.h>
struct
Bookinfo
{
char
[20] bname;
int
pages;
int
price;
}book[3];
int
main(
int
argc,
char
*argv[])
{
int
i;
for
(i=0;i<3;i++)
{
printf(
"\nEnter the Name of Book : "
);
gets(book[i].bname);
printf(
"\nEnter the Number of Pages : "
);
scanf(
"%d"
,book[i].pages);
printf(
"\nEnter the Price of Book : "
);
scanf(
"%f"
,book[i].price);
}
printf(
"\n--------- Book Details ------------ "
);
for
(i=0;i<3;i++)
{
printf(
"\nName of Book : %s"
,book[i].bname);
printf(
"\nNumber of Pages : %d"
,book[i].pages);
printf(
"\nPrice of Book : %f"
,book[i].price);
}
return
0;
}
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
Program enter 5 Students & 5 marks & sum marks c++ console
Needs to create the Strong Name using CPP CLR VS 2010.