1#include <stdio.h>
2int main() {
3 int n, rev = 0, remainder;
4 printf("Enter an integer: ");
5 scanf("%d", &n);
6 while (n != 0) {
7 remainder = n % 10;
8 rev = rev * 10 + remainder;
9 n /= 10;
10 }
11 printf("Reversed number = %d", rev);
12 return 0;
13}
1#include <stdio.h>
2int main() {
3 int n, rev = 0, remainder;
4 printf("Enter an integer: ");
5 scanf("%d", &n);
6 while (n != 0) {
7 remainder = n % 10;
8 rev = rev * 10 + remainder;
9 n /= 10;
10 }
11 printf("Reversed number = %d", rev);
12 return 0;
13}
14
15
1void printReverse(int n) {
2 if (n < 1) return;
3 cout << n << endl;
4 printReverse(n - 1);
5}
6
7printReverse(10); /// 10 9 8 7 6 5 4 3 2 1
1#include <stdio.h>
2int main() {
3 int n, rev = 0, remainder;
4 printf("Enter an integer: ");
5 scanf("%d", &n);
6 while (n != 0) {
7 remainder = n % 10;
8 rev = rev * 10 + remainder;
9 n /= 10;
10 }
11 printf("Reversed number = %d", rev);
12 return 0;
13}
14