1#include <iostream>
2using namespace std;
3int main()
4{
5 char str[] = "Reverseme";
6 char reverse[50];
7 int i=-1;
8 int j=0;
9 /*Count the length, until it each at the end of string.*/
10 while(str[++i]!='\0');
11 while(i>=0)
12 reverse[j++]=str[--i];
13 reverse[j]='\0';
14 cout<<"Reverse of a string is"<< reverse;
15 return 0;
16}
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
1
2#include <stdio.h>
3#include <string.h>
4
5int main()
6{
7 char str[2][100];
8 printf("Type Text: ");
9
10 scanf("%[^\n]%*c", str[0]);
11 int length = strlen(str[0]);
12 int i, j;
13 for (i = 0, j = length - 1; i < length; i++, j--)
14 {
15 str[1][i] = str[0][j];
16 }
17 printf("Original Word: %s\n", str[0]);
18 printf("Reverse word: %s\n", str[1]);
19 return 0;
20}