Home Basic Loop Array string Function Pointer Contact STUDY

AHF    C    PROGRAM    SOLVING

Programming tips

Working with switch case



" ; " after loop



Test expression



Comment



Specifer




Enter a number and Print each digits as even or odd number




// AHF C PROGRAM SOLVING

//solving here ITERATIVES STATEMENTS type of programming problem

#include<stdio.h> #include<math.h> #define pf printf int main() { int n,temp; //taking the value to continue the loop pf("\nEnter any number number: "); scanf("%d",&n); while(n!=0) //ending condition of the loop { temp=n%10; if(temp%2==0) //testing and printing pf("\n%d is even number.",temp); else pf("\n%d is odd number.",temp); n/=10; //update loop } return 0; }
OUTPUT:


© 2018 - All rights reserved