Professional Documents
Culture Documents
Experiment:19: Problem Statement
Experiment:19: Problem Statement
RollNumber:712039
Branch:Mechanical
Experiment:19
Problem
Writeaprogramtoreadthedetailsof‘n’employees(id,name,salary)and
Statement
displaythedetailsofthoseemployeeswhosesalaryisabovers.10,000/-.
Problem
Definition a. InputSpecification:R ead‘N’asNoofEmployees.Andalsoread
EmployeedetailsthatconsistofEmp_ID,Emp_Name,Salary
b. Processspecification:Checkeachemployee’sSalary,ifit’sgreaterthan
Rs.10,000/-
c. OutputSpecification:D isplaytheEmployeedetailsiftheyfallinthe
category
Algorithm BEGIN
DECLARESTRUCTUREEMP{EMP_ID,EMP_NAME,
SALARY}
READN
FORI=0TON-1INCREMENTBY1
READEMP_ID,EMP_NAME,SALARY
ENDFOR
FORI=0TON-1INCREMENTBY1
IFEMP->SALARY>10000THEN
PRINTEMP_ID,EMP_NAME,SALARY
ENDIF
ENDFOR
END
Flowchart
Program #include<stdio.h>
#include<stdlib.h>
structEmployee
{
charname[30];
intid;
intsalary;
};
intmain()
{
inti,n=2;
structEmployeeemployees[n];
printf("Enter%dEmployeeDetails\n\n",n);
for(i=0;i<n;i++)
{
printf("Employee%d:-\n",i+1);
printf("Name:");
scanf("%s",employees[i].name);
printf("Id:");
scanf("%d",&employees[i].id);
printf("Salary:");
scanf("%d",&employees[i].salary);
printf("\n");
}
printf("..............AllEmployeesDetailswithSalaryGreaterthan10,000..............\n");
for(i=0;i<n;i++)
{
if(employees[i].salary>10000)
{
printf("Name\t:");
printf("%s\n",employees[i].name);
printf("Id\t:");
printf("%d\n",employees[i].id);
printf("Salary\t:");
printf("%d\n",employees[i].salary);
printf("\n");
}
}
return0;
}
Output