Write a program in c to read the name age and basic salary of n employee and write these data to a file?
#include<stdio.h>
#include<conio.h>
void main()
{ FILE *fp;
char nm[50];
int a,b,n,i;
printf("\nInput file name:");
gets(nm);
printf("\nEnter no. of employees:");
scanf("%d",&n);
fp=fopen(nm,"w");
printf("Input Invendory Data:\n");
printf("Enter name age basic salary\n");
for(i=1;i<=n;i++)
{ scanf("%s %d %d",nm,&a,&b);
fprintf(fp,"%s %d %d",nm,&a,&b);
}
fclose(fp);
getch();
}
If the ans helps you,plz increase the trust point.