Completely Solved C, C++ Programs Assignment.




C Program to read data in 3 structures and print

Filed Under:

Problem 67. C Program to read data in 3 structures and print
#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( );
}

C compiler: gcc 4.1.2

 Back to main directory: Sample C Program | Software Practical | Solved C Assignment


Get Free Programming Tutorials and Solved assignments