Click here to Skip to main content
15,444,626 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
#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
Posted
Updated 24-Jun-22 0:25am
Comments
Richard Deeming 24-Jun-22 6:24am     CRLF
If you want someone to help you fix a problem with your code, you need to provide a clear and complete description of the problem, what you have tried, and where you are stuck. Dumping your code and asking someone to fix "an issue", without specifying what that issue is, does not make for a good question.

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900