Write a program in c to input and print details of an employee the id,name,salary using structure
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
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Program:
Output:
need an explanation for this answer? contact us directly to get an explanation for this answer