Menu Close

Print Name,Author and genre using union….[Cprogm]FTC

Director Manirathnam wants to direct a movie on a high budget. 
So He was searching for a historical novels in the book shop.  One of his friend P C Sreeram suggested him some of the best novels that can be converted into movie.

Based on his suggestion Manirathnam has collected Name, Author, and Genre details of those books.

Since the number of books is huge Manirathnam is seeking for your help in arranging the details collected by him in a particular format so that it will be helpful for him to move into story discussion.

Input:
First line of the input type string representing Name of the Book

Second line of the input type string representing Author of the Book

Third line of the input type string representing Genre of the Book

Output:
Print the details of the novels in the format expected by Manirathnam .
#include <stdio.h>
union book
{
 char title[100],writer[100],genre[100];
};
int main()
{
 union book b1;
 scanf("%s",b1.title);
 printf("Title:%s\n",b1.title);
 scanf("%s",b1.writer);
 printf("Writer:%s\n",b1.writer);
 scanf("%s",b1.genre);
 printf("Genre:%s\n",b1.genre);
return 0;
}

INPUT_1:
PonniyinSelvan
KalkiKrishnamurthy
Historical

OUTPUT:
Title:PonniyinSelvan
Writer:KalkiKrishnamurthy
Genre:Historical


INPUT_2:
WingsofFire
AbdulKalam
Autobiography

OUTPUT:
Title:WingsofFire
Writer:AbdulKalam
Genre:Autobiography