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
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.
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.
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 ITERATIVES STATEMENTS type of programming problemOUTPUT:
#include<stdio.h> #include<math.h> #define pf printf int main() { int a; float i,res=0.0,temp; //taking the number to continue loop pf("Enter any number: "); scanf("%d",&a); for(i=1.0;i<=a;i++) { float temp=0.0; temp=i/(i+1); //calculating as given in the series and assigning temp res+=temp; //value of the temp is adding with res variable } pf("\nThe summation of the series is: %f",res); return 0; }