An interactive c program to read basic salary of 15
persons. each person gets 25% of basic as HRA, 15%of basic
as conveyance allowances, 10%of basic as entertainment
allowances.The total salary is calculated by adding
basic+HRA+CA+EA.Calculate how many out of 15 get salary
above 10,000.Rs also print the salary of each employee
Answers were Sorted based on User's Feedback
Answer / vignesh1988i
#include<stdio.h>
#include<conio.h>
void main()
{
int salary[50],n,count=0,result[50];
float HRA,CON,JOLLY,TOT_salary;
clrscr();
printf("enter no. of employees : ");
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
printf("%d) ",i);
scanf("%d",&salary[i-1]);
HRA=0.25*salary;
CON=0.15*salary;
JOLLY=0.10*salary;
TOT_salary=HRA+CON+JOLLY;
printf("\nnet salary for %d) is :%f\n",i,TOT_salary);
if(TOT_salary>10000)
{
count++; // TO COUNT EMPLOYEES GETTING MORE THAN 10,000
result[i-1]=i; //TO SAY WHICH SERIAL NO. GETS ABOVE 10,000
}
}
printf("the total no. of employees crossed rs. 10,000 is :%d & respected numbers as above is :",count);
for(i=0;i<count;i++)
printf("%d)\n ",result[i]);
getch();
}
| Is This Answer Correct ? | 7 Yes | 3 No |
Answer / gunda raj
void main()
{
int COUNT=0,BS,HRA,CA,EA,TOTAL[20] ;
FOR(int i=0;i<15;i++)
{
cout<<"enter basic salary";
cin>>BS;
HRA=(BS/100)*25;
CA=(BS/100)*15;
EA=(BS/100)*10;
TOTAL=BS+HRA+CA+EA;
cout<<"total salary of"<<i<< "employee is"<<TOTAL[i];
}
FOR(INT I=0;I<=14;I++)
{
if(TOTAL[I]>=10000)
COUNT++
}
COUT<<"THE NUMBER OF EMPLOYEES ABOVE 10000 ARE"<<COUNT;
}
| Is This Answer Correct ? | 4 Yes | 4 No |
Why is C called a middle-level language?
List some basic data types in c?
what r the cpu registers r ther?
Explain what is the benefit of using #define to declare a constant?
How macro execution is faster than function ?
hello friends what do u mean by BUS ERROR i got this error while i am doing my program in DATA STRUCTURES
What are runtime error?
Write a program, where i have a grid with many cells, how many paths are possible from one point to other desired points.
Write a program that his output 1 12 123
main() { int i; for(i=0;i<5;i++) printf("%d",1l<<i); } why doesn't 'l' affect the code??????
What is an lvalue?
How to removing white spces in c programming only bu using loops