C Prog. - Structures

913 views

Published on

Published in: Education, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
913
On SlideShare
0
From Embeds
0
Number of Embeds
88
Actions
Shares
0
Downloads
57
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

C Prog. - Structures

  1. 1. C Programming - StructuresOrganized By: Vinay Arora Assistant Professor, CSED Thapar University, Patiala
  2. 2. Program - 1 #include<stdio.h> getch(); #include<conio.h> } void main() { char name[3]; float price[3],i; clrscr(); printf("Enter names, price of 3 booksn"); for(i=0;i<=2;i++) scanf("n%c %f",&name[i],&price[i]); printf("nAnd this is what you have enteredn"); for(i=0;i<=2;i++) printf("%c %fn",name[i],price[i]); Vinay Arora CSED
  3. 3. Program – 1 (output) Vinay Arora CSED
  4. 4. Program - 2 #include<stdio.h> printf("nAnd this is what you have enteredn"); #include<conio.h> printf("n%c %f",b1.name,b1.price); void main() printf("n%c %f",b2.name,b2.price); { printf("n%c %f",b3.name,b3.price); struct book { getch(); char name; } float price; }; struct book b1,b2,b3; clrscr(); printf("Enter names, price of 3 booksn"); scanf("n%c %f",&b1.name,&b1.price); scanf("n%c %f",&b2.name,&b2.price); scanf("n%c %f",&b3.name,&b3.price); Vinay Arora CSED
  5. 5. Program – 2 (output) Vinay Arora CSED
  6. 6. Thnx… Vinay Arora CSED

×