+ 1

Reverse numbers

how to reverse numbers in C program.....using function #include<stdio.h> int numbers(int); int main () { int n; printf("Enter Value Of n"); scanf("%d",&n); printf("reverse of enteres values %d",numbers(n)); } int numbers(int n ){ int reverse; while(n!=0){ reverse=reverse *10; reverse= reverse +n%10; n=n/10; return 0; } }

13th May 2018, 11:29 AM
Jordan
Jordan  - avatar
3 odpowiedzi
13th May 2018, 11:40 AM
Manorama
Manorama - avatar
+ 1
initialize reverse=0 in function close while loop before return 0 statement. return value of reverse to main() return reverse;
13th May 2018, 11:36 AM
Manorama
Manorama - avatar
0
yes thanks there is one more question cal you help about that?
13th May 2018, 12:06 PM
Jordan
Jordan  - avatar