• Language

    C

  • Description

    A program that will enter the salary of a worker in your school. If the salary is below 10,000 the program should be able to deduct 5% task from the salary, however if the salary is 10,000 it should deduct 10% task from the salary. Then display the actual salary and the net salary.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <stdio.h>
#include <stdlib.h>

int main (void)
{
    float actual_salary, deduction, net_salary, salary_of_a_worker;
    printf ("Enter the value of salary of a worker: ");
    scanf ("%f", &salary_of_a_worker);
    (void) getchar ();
    if(salary_of_a_worker<10000)
        deduction=salary_of_a_worker*0.05;
    else
        deduction=salary_of_a_worker*0.1;
    actual_salary=salary_of_a_worker;
    net_salary=actual_salary-deduction;
    printf ("Value of actual salary: %g\n", actual_salary);
    printf ("Value of deduction: %g\n", deduction);
    printf ("Value of net salary: %g\n", net_salary);
    putchar ('\n');
    system ("pause");
    return EXIT_SUCCESS;
}