Untitled

mail@pastecode.io avatar
unknown
plain_text
21 days ago
1.3 kB
2
Indexable
Never
#include <stdio.h>
#include <stdlib.h>
struct address{
    char city[10];
    char state[10];
    int pin;
}a1[10];
struct employee {
    int emp_id;
    char name[10];
    char desig[10];
    struct address a1[10];
    int base;
}emp1[10];
int main()
{
    int i,n;
    struct employee emp1[10];
    printf("enter the number records to be stored:");
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        printf("enter the info for %d employee:\n",i+1);
        scanf("%d %s %s %d %s %s %d",&emp1[i].emp_id,emp1[i].name,emp1[i].desig,&emp1[i].base,emp1[i].a1[i].city,emp1[i].a1[i].state,&emp1[i].a1[i].pin);
    }
    for(i=0;i<n;i++)
    {
        printf("the details of employee %d are : \n",i+1);
        printf("emp_id: %d\n",emp1[i].emp_id);
        printf("name: %s \n",emp1[i].name);
        printf("desig: %s \n",emp1[i].desig);
        printf("base: %d \n",emp1[i].base);
        printf("hra: %d \n",(emp1[i].base * 15)/100 );
        printf("da: %d \n",(emp1[i].base * 25)/100);
        printf("gross salary : %d \n",(emp1[i].base + ((emp1[i].base *15)/100) +((emp1[i].base * 25)/100)));
        printf("address city: %s \n",emp1[i].a1[i].city);
        printf("address state: %s \n",emp1[i].a1[i].state);
        printf("address pin: %d \n",emp1[i].a1[i].pin);
       

    }
    return 0;

}
Leave a Comment