#include<stdio.h>
struct emp
{
char name[50];
int salary;
};
void main()
{
int n,i,sum=0,avg;
struct emp e[20],ls,hs;
printf("Enter the number of employee : ");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("Enter the name and salary of employees : ");
scanf("%s%d",e[i].name,&e[i].salary);
sum = sum + e[i].salary;
}
avg = sum/n;
ls.salary=e[0].salary;
for(i=1;i<n;i++)
{
if(ls.salary>e[i].salary)
{
ls=e[i];
}
}
hs.salary=e[0].salary;
for(i=1;i<n;i++)
{
if(hs.salary<e[i].salary)
{
hs=e[i];
}
}
printf("\nAVERAGE SALARY = %d",avg);
printf("\n\nThe highest salary of employee is\nNAME\t\tSALARY");
printf("\n%s\t\t%d",hs.name,hs.salary);
printf("\n\nThe lowest salary of employee is\nNAME\t\tSALARY");
printf("\n%s\t\t%d",ls.name,ls.salary);
printf("\n\nEMPLOYEE HAVING SALARY ABOVE 15000");
printf("\nNAME\t\tSALARY");
for(i=0;i<n;i++)
{
if(e[i].salary>15000)
{
printf("\n%s\t\t%d",e[i].name,e[i].salary);
}
}
getch();
}
Related Posts:
Operations on complex numbers in C#include<stdio.h>
struct cmplx
{
float real;
float img;
};
struct cmplx add(struct cmplx x, struct cmplx y)
{
struct cmplx z;
z.real = x.real + y.real;
&nbs… Read More
Find triangular no. in C#include<stdio.h>
void main()
{
int n1,n2,i,t;
printf("Enter two numbers : ");
scanf("%d%d",&n1,&n2);
for(i=1;i<=n2;i++)
{
&… Read More
Find no. of vowels in a string in C
#include<stdio.h>
void strcount(char []);
void main()
{
char str[50];
char c;
while(1)
{
printf("enter string\n");
//gets(str);
scanf("%s",str);
&nb… Read More
Find highest paid employee in C#include<stdio.h>
struct emp
{
char name[50];
int salary;
};
void main()
{
int n,i,sum=0,avg;
struct emp e[20],ls,hs;
printf("Enter the number of emp… Read More
Arranging numbers in ascending and descending order in C#include<stdio.h>
void main()
{
int x[5],i,j,temp;
for(i=0;i<=4;i++)
{
printf("Enter x[%d]th number : ",i);
scanf("%d"… Read More
0 comments:
Post a Comment