Home Basic Loop Array string Function Pointer Contact STUDY

AHF    C    PROGRAM    SOLVING

Programming tips

" ; " after loop



Header file



Working with switch case



Iterative statement



Specifer




Print even and odd number untill ( 00 ) is encountered




// AHF C PROGRAM SOLVING

//solving here ITERATIVES STATEMENTS type of programming problem

#include<stdio.h> #include<math.h> #define pf printf int main() { int number; int count= 0; float ave; pf("\nEnter any number. Enter 00 to exit........\t: "); scanf("%d",&number); //this input will start the loop while(number!=00) //ending condition of the loop { if(number%2) //testing condition for even or odd pf("\n%d is odd number.",number); else pf("\n%d is even number.",number); count++; //counting for total given input pf("\nEnter any number. Enter 00 to exit........\t: "); scanf("%d",&number); //this input will stop the loop } //printing the required statement pf("\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"); pf("\nTotal given input= %d",count); return 0; }
OUTPUT:


© 2018 - All rights reserved