I got the results right, but my professor wants me to finish the program without using math.h header or any functions.Code:#include <stdio.h> #include <math.h> int reverse(int a) { int i=0,j, sum=0, scan; scan=a; while(a>0) { a=a/10; i++; } a=scan; for(j=0;j<i;j++) { sum+=(a%(int)pow(10,i-j))/(int)pow(10,i-j-1)*(int)pow(10,j); } return sum; } void main() { int b; scanf("%d", &b); printf("%d\n", reverse(b)); }
Please help me!