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.
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.
// AHF C PROGRAM SOLVING //solving here ITERATIVES STATEMENTS type of programming problemOUTPUT:
#include<stdio.h> #include<math.h> #define pf printf int main() { int number; int positive= 0,negative= 0,zero= 0,count=0; pf("\nEnter any number. Enter -1 to exit........\t: "); scanf("%d",&number); //this input will start the loop while(number!=-1) //ending condition of loop { if(number>0) positive++; else if(number&lg0) negative++; else zero++; count++; //counting for total given input pf("\nEnter any number. Enter -1 to exit........\t: "); scanf("%d",&number); //this input will stop the loop } //printing the required statement pf("\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"); pf("\n\nCount of positive number= %d",positive); pf("\nCount of negative number= %d",negative); pf("\ncount of zero= %d",zero); pf("\nTotal given input= %d",count); return 0; }