Employee's Salary

SemiColon
By -
1 minute read
0
9. Write a C program that accepts an employee's ID, total worked hours of a month 
and the amount he received per hour. Print the employee's ID and salary 
(with two decimal places) of a particular month.

Sample input:  

Input the Employees ID : 42
Input the working hrs: 8
Salary amount/hr: 15000

Sample Output:

Employees ID = 42
Salary = 120000.00 


Solution:




#include<stdio.h>
int main()
{
    double E_I, worked_hour, amount, salary;

    printf("Input the Employees ID : ");
    scanf("%lf", &E_I);
    printf("Input the working hrs: ");
    scanf("%lf", &worked_hour);
    printf("Salary amount/hr: ");
    scanf("%lf", &amount);

    salary=worked_hour*amount;

    printf("Employees ID = %.lf\n", E_I);
    printf("Salary = %.2lf\n", salary);

    return 0;
}

Tags:

Post a Comment

0Comments

Post a Comment (0)