Program to read data in 3 structures and print - 100 Most Important C# Programs

100 Most Important C# Programs

67. Program to read data in 3 structures and print

Code:

# include<stdio.h>

# include<conio.h>

main( )

{

struct book

{

char code;

int piece;

float price;

};

struct book b1,b2,b3;

main( )

{

clrscr( );

printf(“enter code,piece,price”);

scanf(“%c%d%f”,&b1.code,&b1.piece,&b1.price);

printf(“enter code,piece,price”);

scanf(“%c%d%f”,&b2.code,&b2.piece,&b2.price);

printf(“enter code,piece,price”);

scanf(“%c%d%f”,&b3.code,&b3.piece,&b3.price);

printf(“the details are”);

printf(“\n %c%d%f”,b1.code,b1.piece,b1.price);

printf(“\n %c%d%f”,b2.code,b2.piece,b2.price);

printf(“\n %c%d%f”,b3.code,b3.piece,b3.price);

getch( );

}