// Program of struct
#include
#include
void main()
{
clrscr();
char author[20];
struct MATH_BOOK
{
int book_num;
char auther[20];
char publish[20];
float price;
};
struct MATH_BOOK bkinfo;
printf("Enter the book number\n");
scanf("%d", &bkinfo.book_num);
printf("Enter the name of author\n");
scanf("%s", &author);
printf("Enter the name of publisher\n");
scanf("%s", &bkinfo.publish);
printf("Enter the price of book\n");
scanf("%f", &bkinfo.price);
printf("..............\n");
printf(" MATH_BOOK\n");
printf("..............\n");
printf("Book number : %d \n", bkinfo.book_num);
printf("Author : %s \n", author);
printf("Publisher : %s \n", bkinfo.publish);
printf("price : rs.%6.2f\n", bkinfo.price);
printf("............. \n");
getch();
}
Algorithm
· Start
· Declare author[20] as character
· struct MATH_BOOK
· Declare book_num as integer
· Declare publish[20] as character
· Decxlare price as float
· struct MATH_BOOK bkinfo
· Write("the book number")
· Read(“book number”)
· Write("the name of author")
· Read(“the name of author”)
· Write("the name of publisher")
· Read(“the name of publisher”)
· Write(“the price of book”)
· Read(“the price of book”)
· Write("..............")
· Write(" MATH_BOOK")
· Write("..............")
· Read(“Book number”)
· Read("Author")
· Read("Publisher ")
· Read("price")
· Read("............. ")
· Stop
c language sample programs
ReplyDeletec program code Egg Game