fork download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. float basic_salary, house_rent_percentage, total_salary;
  5.  
  6. // Ask the user for basic salary and house rent percentage
  7. printf("Enter the basic salary: ");
  8. scanf("%f", &basic_salary);
  9.  
  10. printf("Enter the percentage of basic salary for house rent: ");
  11. scanf("%f", &house_rent_percentage);
  12.  
  13. // Calculate house rent amount
  14. float house_rent = (house_rent_percentage / 100) * basic_salary;
  15.  
  16. // Calculate total salary
  17. total_salary = basic_salary + house_rent;
  18.  
  19. // Display the total salary
  20. printf("Total salary of the employee: %.2f\n", total_salary);
  21.  
  22. return 0;
  23. }
  24.  
Success #stdin #stdout 0s 5300KB
stdin
 
stdout
Enter the basic salary: Enter the percentage of basic salary for house rent: Total salary of the employee: 0.00