Home Basic Loop Array string Function Pointer Contact STUDY

AHF    C    PROGRAM    SOLVING

Programming tips

" ; " after loop



Test expression



Specifer



Iterative statement



Working with switch case




Function_ count of total digits 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); printf("\nThe total digits of the given integer is : %d",rev); return 0; } //function definition int reveres(int n) //function header //function body { int temp,r=0; while(n!=0) { temp=n%10; r++; //counting digits n/=10; //update loop } return r; }
OUTPUT:


© 2018 - All rights reserved