Home Basic Loop Array string Function Pointer Contact STUDY

AHF    C    PROGRAM    SOLVING

Programming tips

" ; " after loop



Working with switch case



Specifer



Test expression



Iterative statement




Function_ find even and odd of an integer




// AHF C PROGRAM SOLVING

//The problem are solving here using FUNCTION

#include<stdio.h> #include<math.h> #define pf printf //function declaration int reveres(int n); void main() { int x,rev; printf("Enter any number: "); scanf("%d",&x); //function call rev=reveres(x); return 0; } //function definition int reveres(int n) //function header //function body { int temp,r=0; while(n!=0) { temp=n%10; //separating digits of given integer { //checking number if(temp%2==0) pf("\n%d is even number.",temp); else pf("\n%d is odd number.",temp); } n/=10; //update loop } }
OUTPUT:


© 2018 - All rights reserved