Semoclone ( ; ) is one of the best sensitive symbols in programming. Placing a semicolon ( ; ) after the WHILE or FOR loop is not a syntax error. So it will not be reported by the compiler. However, it is considered to be a logical error as it change

The test expression done on exact statement. The good habit of using test expression on exact or fulfill statement. So do not use floating point numbers for checking for equality in the test expression.

When you are using SWITCH case, it is important to keep in mind that the inclusion of DEFAULT LABEL. This will inform you whether you are executing your program in right or wrong way. So, it is always recommended to use DEFAULT LABEL in the SWITCH st

Not putting // before the start of single statement comment is a compiler error. Not putting the */ after the termination of block comment is a compiler error.

The iterative statement is one of the most important and interesting statements in the programming world. An iterative statement is used to repeat the execution of a list of statements, depending on the value of an integer expression.

Where we used a question that is if the sex of the employee is male then he have to pay 5% bonus on his salary or female then she have to pay 10% bonus on her salary and if the salary is less than 10000 then he/she have to pay 20% bonus on his/her salary and there is no distinguished of sex of the employee.

// 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; }

Enter the first character of the sex(for male (m) and for female (f) ): m

Enter the salary of the employee: 45000

SALARY= 45000.00

BONOUS= 2250.00

||||||||||||||||||||||||||||||||||||||||||||||

The total amount to be paid= 47250.00

Enter the first character of the sex(for male (m) and for female (f) ): f

Enter the salary of the employee: 45000

SALARY= 45000.00

BONOUS= 4500.00

||||||||||||||||||||||||||||||||||||||||||||||

The total amount to be paid= 49500.00

Enter the first character of the sex(for male (m) and for female (f) ): m

Enter the salary of the employee: 9000

SALARY= 9000.00

BONOUS= 1800.00

||||||||||||||||||||||||||||||||||||||||||||||

The total amount to be paid= 10800.00

Enter the first character of the sex(for male (m) and for female (f) ): f

Enter the salary of the employee: 9000

SALARY= 9000.00

BONOUS= 1800.00

||||||||||||||||||||||||||||||||||||||||||||||

The total amount to be paid= 10800.00

Enter the salary of the employee: 45000

SALARY= 45000.00

BONOUS= 2250.00

||||||||||||||||||||||||||||||||||||||||||||||

The total amount to be paid= 47250.00

Enter the first character of the sex(for male (m) and for female (f) ): f

Enter the salary of the employee: 45000

SALARY= 45000.00

BONOUS= 4500.00

||||||||||||||||||||||||||||||||||||||||||||||

The total amount to be paid= 49500.00

Enter the first character of the sex(for male (m) and for female (f) ): m

Enter the salary of the employee: 9000

SALARY= 9000.00

BONOUS= 1800.00

||||||||||||||||||||||||||||||||||||||||||||||

The total amount to be paid= 10800.00

Enter the first character of the sex(for male (m) and for female (f) ): f

Enter the salary of the employee: 9000

SALARY= 9000.00

BONOUS= 1800.00

||||||||||||||||||||||||||||||||||||||||||||||

The total amount to be paid= 10800.00

- Enter positive number and convert negative number and vice versa
- Profit or loss on selling goods
- Calculate area and circumference of circle
- In a integer, count digits,sum of digits,reverse the integer and print even and odd digits of the integer
- Find the basic salary, facilities on total salary except tax
- Calculate roots of quadratic equation
- Solve simple formula solution
- Calculate result CGPA in one subject

© 2018 - All rights reserved