Everything else is displaying in file as it is supposed to be other than the salary of the bank employee.
#include <stdio.h>
struct data {
char ide[50], name[50], bname[50], brname[50], con[10], sal[30];
};
int main() {
int n;
printf("Enter number of employees: ");
scanf("%d", &n);
struct data d[n];
for (int i = 1; i <= n; i++) {
printf("Enter data of employee %d\n", i);
printf("1) ID: ");
scanf("%s", d[i].ide);
printf("2) NAME: ");
scanf("%s", d[i].name);
printf("3) SALARY: ");
scanf("%s", d[i].sal);
printf("4) CONTACT: ");
scanf("%s", d[i].con);
printf("5) BANK NAME: ");
scanf("%s", d[i].bname);
printf("6) BRANCH NAME: ");
scanf("%s", d[i].brname);
}
FILE *fp;
fp = fopen("dbms.txt", "w");
for (int i = 1; i <= n; i++) {
fprintf(fp, "1) ID: %s\n2) NAME: %s\n3) SALARY: %s\n4) CONTACT: %s\n5) BANK NAME: %s\n6) BRANCH NAME: %s\n",
d[i].ide, d[i].name, d[i].sal, d[i].con, d[i].bname, d[i].brname);
}
fclose(fp);
}