Write a program to create the above structure and declare a structure variable to get the details and print them. Product details of an iPhone in Flipkart needs to be displayed to the user.


Create structure:
struct Phone
{
int emino;
char name[30];
char color[30];
int modelno;
};
Sample Input:
Enter the emino: 3344
Enter the name: Apple
Enter the colour: red
Enter the model: 3

Sample Output:
Details:
EmiNo: 3344
Name: Apple
Colour: red
Model: 3



Implementation of above problem:
#include<stdio.h>
struct Phone
{
int emino;
char name[30];
char color[30];
int modelno;
};
int main()
{
struct Phone ph;
printf("Enter the emino:\n");
scanf("%d",&ph.emino);
printf("Enter the name:\n");
scanf("%s",ph.name);
printf("Enter the colour:\n");
scanf("%s",ph.color);
printf("Enter the model:\n");
scanf("%d",&ph.modelno);
printf("Details:\n");
printf("EmiNo:%d\n",ph.emino);
printf("Name:%s\n",ph.name);
printf("Colour:%s\n",ph.color);
printf("Model:%d\n",ph.modelno);
return 0;

}



Thanks
Mukesh Rajput
Mukesh Rajput

Mukesh Rajput

I am a Computer Engineer, a small amount of the programming tips as it’s my hobby, I love to travel and meet people so little about travel, a fashion lover and love to eat food, I am investing a good time to keep the body fit so little about fitness also..

Post A Comment:

0 comments: