Q:

Write a program in c to input and print details of an employee the id,name,salary using structure

0

Write a program in c to input and print details of an employee the id,name,salary using structure

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Program:

#include<stdio.h>
#include<conio.h>
struct employee
{
char name[100];
int id;
float salary;
};
void main()
{
struct employee emp;
printf("Enter detials of employee:\n");
printf("Enter employee name:");
scanf("%s",&emp.name);
printf("Enter employee id:");
scanf("%d",&emp.id);
printf("Enter employee salary:");
scanf("%f",&emp.salary);
printf("Detials of employee\n");
printf("Name  :%s\n",emp.name);
printf("Id    :%d\n",emp.id);
printf("salary:%f\n",emp.salary);
getch();
}

Output:

Enter detials of employee:
Enter employee name:aryan
Enter employee id:100
Enter employee salary:20000
Detials of employee
Name  :aryan
Id    :100
salary:20000.000000

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C Programming Exercises With Solutions

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Write a c program to demonstrate array of structur... >>
<< Write a c program to calculate reverse string and ...