Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Name:SAYYAD‌‌MAHED‌‌VAHIDALI‌ 


Roll‌‌Number:712039‌  ‌
Branch:‌‌Mechanical‌  ‌
Experiment:19‌  ‌
 ‌
Problem‌‌
  Write‌‌a‌‌program‌‌to‌‌read‌‌the‌‌details‌‌of‌‌‘n’‌‌employees‌‌(id,‌‌name,‌‌salary)‌‌and‌‌
 
Statement‌  ‌
display‌‌the‌‌details‌‌of‌‌those‌‌employees‌‌whose‌‌salary‌‌is‌‌above‌‌rs.10,000/-.‌  ‌

Problem‌‌   ‌
Definition‌  ‌ a. Input‌‌Specification:‌R‌ ead‌‌‘N’‌‌as‌‌No‌‌of‌‌Employees.‌‌And‌‌also‌‌read‌‌ 
Employee‌‌details‌‌that‌‌consist‌‌of‌‌Emp_ID,‌‌Emp_Name,‌‌Salary‌  ‌
b. Process‌‌specification:‌‌Check‌‌each‌‌employee’s‌‌Salary,‌‌if‌‌it’s‌‌greater‌‌than‌‌  
Rs.‌‌10,000/-‌  ‌
c. Output‌‌Specification:‌D ‌ isplay‌‌the‌‌Employee‌‌details‌‌if‌‌they‌‌fall‌‌in‌‌the‌‌
 
category‌  ‌

Algorithm‌  ‌ BEGIN‌  ‌
DECLARE‌‌STRUCTURE‌‌EMP‌‌{EMP_ID,‌‌EMP_NAME,‌  ‌
SALARY}‌  ‌
READ‌‌N‌  ‌
FOR‌‌I=0‌‌TO‌‌N-1‌‌INCREMENT‌‌BY‌‌1‌  ‌
READ‌‌EMP_ID,‌‌EMP_NAME,‌‌SALARY‌‌  
END‌‌FOR‌  ‌
FOR‌‌I=0‌‌TO‌‌N-1‌‌INCREMENT‌‌BY‌‌1‌  ‌
IF‌‌EMP->SALARY‌‌>‌‌10000‌‌THEN‌  ‌
PRINT‌‌EMP_ID,‌‌EMP_NAME,‌‌SALARY‌‌ 
END‌‌IF‌  ‌
END‌‌FOR‌ 
END‌  ‌
 ‌
 ‌
 ‌  ‌
Flowchart‌  ‌
 
 ‌
 ‌
 ‌
Program‌  ‌ #include‌‌<stdio.h>‌  ‌
#include‌‌<stdlib.h>‌  ‌
 ‌
struct‌‌Employee‌  ‌
{‌  ‌
‌char‌‌name[30];‌  ‌
‌int‌‌id;‌  ‌
‌int‌‌salary;‌  ‌
};‌  ‌
int‌‌main()‌  ‌
{‌  ‌
‌int‌‌i,n=2;‌  ‌
‌struct‌‌Employee‌‌employees[n];‌  ‌
‌printf("Enter‌‌%d‌‌Employee‌‌Details‌‌\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("..............All‌‌Employees‌‌Details‌‌with‌‌Salary‌‌Greater‌‌than‌‌10,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");‌  ‌
‌} ‌ ‌
}‌  ‌
return‌‌0;‌  ‌
}‌  ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
Output‌  ‌

Conclusion‌  ‌ Hence,‌‌  from‌‌


  the‌‌
  following‌‌
  program‌‌
  we‌‌
  can‌‌
  read‌‌
  the‌‌
  Details‌‌
  of‌‌
  the‌‌
  employees‌‌
 and‌ 
also‌‌can‌‌separate‌‌the‌‌employee‌‌with‌‌salary‌‌greater‌‌than‌‌10,000.‌  ‌

 ‌
 ‌
 ‌
 ‌

You might also like