Computer Science, asked by rishabh667151, 8 months ago

write a program to create a binary file name emp.bin containing the name, address, phone number, and salary of n employees whose salary is less than 10000.​

Answers

Answered by ramsinghsame
1

Answer:

/*C program to read and print employee's record using structure*/

#include <stdio.h>

/*structure declaration*/

struct employee{

char name[30];

int empId;

float salary;

};

int main()

{

/*declare structure variable*/

struct employee emp;

/*read employee details*/

printf("\nEnter details :\n");

printf("Name ?:"); gets(emp.name);

printf("ID ?:"); scanf("%d",&emp.empId);

printf("Salary ?:"); scanf("%f",&emp.salary);

/*print employee details*/

printf("\nEntered detail is:");

printf("Name: %s" ,emp.name);

printf("Id: %d" ,emp.empId);

printf("Salary: %f\n",emp.salary);

return 0;

}

Similar questions