Showing posts with label PROGRAM FOR SIZE OF UNION. Show all posts
Showing posts with label PROGRAM FOR SIZE OF UNION. Show all posts

Saturday, January 31, 2015

PROGRAM FOR SIZE OF UNION

PROGRAM:

#include<stdio.h> union book

{

int price;

char bname[20];

};

main()

{

union book b;


printf("Enter the Book Details:\n");
printf("Enter the Book Name:\n"); scanf("%s",&b.bname); printf("Enter the Book Price:\n"); scanf("%d",&b.price); printf("BOOK DETAILS:\n"); printf("%s\t%d\n",b.bname,b.price); printf("Enter the Book Name:\n"); scanf("%s",b.bname);

printf("Book Name=%s\n",b.bname);
}

OUTPUT:

Enter the Book Details: Enter the Book Name: English

Enter the Book Price: 150

BOOK DETAILS:
รป                150

Enter the Book Name:

English
Book Name=English