Q#1 Write a C program to accept the height of a person in centimeter and categorize the person according to their height.(IF-ELSE IF)
HEIGHT < 150 = Dwarf
HEIGHT = 150 = Average height.
HEIGHT > = 165 = TALL.
Q#2 Write a program to make decision for the employees ‘salary as under:
Employees’ salary HRA added to the salary DA
Less than Rs. 5000 20% of basic salary of HRA 90% of basic salary DA
Equal to Rs. 5000 or above Rs. 2000 will be added of HRA 95% of basic salary DA
Take input of the employee salary and find the gross salary of the employee based on above conditions.
NOTE: HRA is House Rent Allowance , DA is Dearness Allowance
#include <stdio.h>
int main()
{
float HEIGHT;
printf("input the height of the person in centimeters:");
scanf("%f", &HEIGHT);
if(HEIGHT<150.0){
printf("The person is Dwarf.\n");
}
else if((HEIGHT>=150.0) && (HEIGHT<165.0))
{
printf("The person is average heighted.\n");
}
else if ((HEIGHT>=165.0) && (HEIGHT<=195.0))
{
printf("The person is taller.\n");
}
else{
printf("The height is out of range.\n");
}
return 0;
}
Comments
Leave a comment