Untitled
#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); int base; struct a1; }emp1[10]; int main() { int i,n; struct employee s[10]; printf("enter the number records to be stored:"); scanf("%d",&n); for(i=0;i<n;i++) { printf("enter the info for %d student:\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.city,emp[1].a1.state,&emp1[i].a1.pin); } for(i=0;i<n;i++) { printf("the details of std %d are : \n",i+1); printf("emp_id: %d",emp1[i].emp_id); printf("name: %s",emp1[i].name); printf("desig: %d",emp1[i].desig); printf("base: %d",emp1[i].base); printf("hra: %d",(emp1[i].base * 15)/100 ); printf("da: %d",(emp1[i].base * 25)/100); printf("gross salary : %d",(emp[i].base + ((emp[i].base *15)/100) +((emp1[i].base * 25)/100))); printf("address city: %s",emp1[i].a1.city); printf("address state: %s",emp1[i].a1.state); printf("address pin: %d",emp1[i].a1.pin); } return 0; }
Leave a Comment