1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | #include<stdio.h> #include<conio.h> #include<string.h> struct Book { int bid; char title[10]; float price; }; void main() { int loc,mini,i; struct Book b[10]; for(i=0;i<=9;i++) { printf("Enter book ID\n"); scanf("%d",&b[i].bid); scanf("%d",&b[i].title); scanf("%d",&b[i].price); mini=b[0].price; } loc=0; for(i=0;i<=9;i++) if(b[i].price<mini) { mini=b[i].price; loc=i; } printf("Book having minimum price is\n"); printf("BookID=%d\n",b[loc].bid); printf("BookID=%d\n",b[loc].title); printf("BookID=%d\n",b[loc].price); } |
Subscribe to:
Post Comments
(
Atom
)
Post a Comment