Home Basic Loop Array string Function Pointer Contact STUDY

AHF    C    PROGRAM    SOLVING

Programming tips

Working with switch case



Specifer



Header file



Iterative statement



" ; " after loop




Bonus on employment salary



// AHF C PROGRAM SOLVING

//solving here basic type of programming problem

#include<stdio.h> #include<math.h> #define pf printf int main() { char ch; float sal,bon,amt_to_be_paid; pf("\nEnter the first character of the sex(for male (m) and for female (f) ): "); scanf("%c",&ch); pf("Enter the salary of the employee: "); scanf("%f",&sal); if(ch=='m') bon=.05*sal; else bon=.10*sal; /* Extra condition on bonus This bonus will be given whose salary is less than 10000 There is no fact if the employee is male or female */ if(sal<10000) bon=.20*sal; //This statement is valid for all sex ( m or f ) and employee amt_to_be_paid=bon+sal; pf("\nSALARY= %.2f",sal); pf("\nBONOUS= %.2f",bon); pf("\n||||||||||||||||||||||||||||||||||||||||||||||"); pf("\nThe total amount to be paid= %.2f",amt_to_be_paid); return 0; }
OUTPUT:


© 2018 - All rights reserved