/* Simple C program for accepting and printing information in given Structure*/
#include<stdio.h>
struct employee
{
int eid;
char ename[20];
float salary;
};
int main()
{
int i,n;
struct employee e[n];
printf("\n Enter a value of n: ");
scanf("%d",&n);
printf("\n Enter details of %d employees:",n);
for(i=0;i<n;i++)
{
printf("\n Enter employee id: ");
scanf("%d",&e[i].eid);
printf("\n Enter name of employee:");
scanf("%s",e[i].ename);
printf("\n Enter salary of employee:");
scanf("%f",&e[i].salary);
}
printf("\n ****The employee details:****");
for(i=0;i<n;i++)
{
printf("\n The employee id:%d \n",e[i].eid);
printf("\n The name of Employee:%s \n",e[i].ename);
printf("\n The salary of Employee:%.2f Rupees\n",e[i].salary);
}
return 0;
}
struct employee
{
int eid;
char ename[20];
float salary;
};
int main()
{
int i,n;
struct employee e[n];
printf("\n Enter a value of n: ");
scanf("%d",&n);
printf("\n Enter details of %d employees:",n);
for(i=0;i<n;i++)
{
printf("\n Enter employee id: ");
scanf("%d",&e[i].eid);
printf("\n Enter name of employee:");
scanf("%s",e[i].ename);
printf("\n Enter salary of employee:");
scanf("%f",&e[i].salary);
}
printf("\n ****The employee details:****");
for(i=0;i<n;i++)
{
printf("\n The employee id:%d \n",e[i].eid);
printf("\n The name of Employee:%s \n",e[i].ename);
printf("\n The salary of Employee:%.2f Rupees\n",e[i].salary);
}
return 0;
}
0 Comments