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.

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

Missing the inclusion of appropriate header file in c program will generate an error. Such a program may compile but the linker will given an error message as it will not be able to find the functions used in the program.

Specifier is a typedef-name and a very sensitive in C programming. Using an incorrect specifier for the data type being read or written will generate a run time error.

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.

// AHF C PROGRAM SOLVING //solving here basic type of programming problem

#include<stdio.h> #include<math.h> #include<stdlib.h> #define pf printf int main() { int choice; while(1){ pf("\nEnter your choice "); pf("\nEnter 1 for summation "); pf("\nEnter 2 for subtraction "); pf("\nEnter 3 for multiplication "); pf("\nEnter 4 for division .......... "); pf("\nEnter 5 to Exit .......... "); scanf("%d",&choice); switch(choice) { case 1: { int x,y,sum=0; pf("\nEnter first and second number: "); scanf("%d %d",&x,&y); sum=x+y; pf("\nThe summation = %d",sum); } break; case 2: { int x,y,sub=0; pf("\nEnter first and second number: "); scanf("%d %d",&x,&y); sub=x-y; pf("\nThe summation = %d",sub); } break; case 3: { int x,y,mul=0; pf("\nEnter first and second number: "); scanf("%d %d",&x,&y); mul=x*y; pf("\nThe summation = %d",mul); } break; case 4: { float x,y,div=0; pf("\nEnter first and second number: "); scanf("%f %f",&x,&y); div=x/y; pf("\nThe summation = %f",div); } break; case 5: exit(1); default : pf("\nInvalid Input."); } } return 0; }

Enter your choice

Enter 1 for summation

Enter 2 for subtraction

Enter 3 for multiplication

Enter 4 for division ..........

Enter 5 to Exit .......... 1

Enter first and second number: 1 2

The summation = 3

Enter your choice

Enter 1 for summation

Enter 2 for subtraction

Enter 3 for multiplication

Enter 4 for division ..........

Enter 5 to Exit .......... 2

Enter first and second number: 3 6

The summation = -3

Enter your choice

Enter 1 for summation

Enter 2 for subtraction

Enter 3 for multiplication

Enter 4 for division ..........

Enter 5 to Exit .......... 3

Enter first and second number: 2 3

The summation = 6

Enter your choice

Enter 1 for summation

Enter 2 for subtraction

Enter 3 for multiplication

Enter 4 for division ..........

Enter 5 to Exit .......... 4

Enter first and second number: 5 6

The summation = 0.833333

Enter your choice

Enter 1 for summation

Enter 2 for subtraction

Enter 3 for multiplication

Enter 4 for division ..........

Enter 5 to Exit .......... 5

The program is finished.

Enter 1 for summation

Enter 2 for subtraction

Enter 3 for multiplication

Enter 4 for division ..........

Enter 5 to Exit .......... 1

Enter first and second number: 1 2

The summation = 3

Enter your choice

Enter 1 for summation

Enter 2 for subtraction

Enter 3 for multiplication

Enter 4 for division ..........

Enter 5 to Exit .......... 2

Enter first and second number: 3 6

The summation = -3

Enter your choice

Enter 1 for summation

Enter 2 for subtraction

Enter 3 for multiplication

Enter 4 for division ..........

Enter 5 to Exit .......... 3

Enter first and second number: 2 3

The summation = 6

Enter your choice

Enter 1 for summation

Enter 2 for subtraction

Enter 3 for multiplication

Enter 4 for division ..........

Enter 5 to Exit .......... 4

Enter first and second number: 5 6

The summation = 0.833333

Enter your choice

Enter 1 for summation

Enter 2 for subtraction

Enter 3 for multiplication

Enter 4 for division ..........

Enter 5 to Exit .......... 5

The program is finished.

- Eligible age for vote
- Calculate area of a circle
- Calculate area of a triangle
- Calculate area of a rectangle
- Calculate area of a rectangle, triangle and circle
- Bonus on employment salary
- Print even or odd number
- Leap year
- Input any key from key-board and display key's feature
- Find large number of two or three given numbers
- Print ASCII value of a character and number
- Print all ASCII value

© 2018 - All rights reserved