#include <stdio.h>
#include <string.h>
struct employee{
int code;
float salary;
char name[15];
};
int main()
{
struct employee e1, e2, e3;
printf("Enter the code of employe\n");
scanf("%d", &e1.code );
printf("Enter the salary of employe\n");
scanf("%f", &e1.salary);
printf("Enter the name of employe\n");
scanf("%s", e1.name);
printf("Enter the code of employe\n");
scanf("%d", &e2.code );
printf("Enter the salary of employe\n");
scanf("%f", &e2.salary);
printf("Enter the name of employe\n");
scanf("%s", e2.name);
printf("Enter the code of employe\n");
scanf("%d", &e3.code);
printf("Enter the of salary of employe\n");
scanf("%f", &e3.salary);
printf("Enter the name of employe\n");
scanf("%s", e3.name);
return 0;
}
// why I am facing problem in excecuting code 2
code 2
#include <stdio.h>
#include <string.h>
struct employee{
int code;
float salary;
char name[15];
};
int main()
{
struct employee e1, e2, e3;
printf("Enter the code of employe\n");
scanf("%d\n", &e1.code );
printf("Enter the salary of employe\n");
scanf("%f\n", &e1.salary);
printf("Enter the name of employe\n");
scanf("%s\n", e1.name);
printf("Enter the code of employe\n");
scanf("%d\n", &e2.code );
printf("Enter the salary of employe\n");
scanf("%f\n", &e2.salary);
printf("Enter the name of employe\n");
scanf("%s\n", e2.name);
printf("Enter the code of employe\n");
scanf("%d\n", &e3.code);
printf("Enter the of salary of employe\n");
scanf("%f\n", &e3.salary);
printf("Enter the name of employe\n");
scanf("%s\n", e3.name);
return 0;
}
What I have tried:
I tried to write a employee data