In this tutorial you will learn about the C Program to Check Reverse equal Original and its application with practical example.
C Program to Reverse equal Original
In this tutorial, we will learn to create a C program that will Reverse equal Original in C programming.
Prerequisites
Before starting with this tutorial we assume that you are best aware of the following C programming topics:
- Operators in C Programming.
- Basic Input and Output function in C Programming.
- Basic C programming.
- While loop in C programming.
Program to Reverse equal Original:-
As we all know the c is a very powerful language. With the help of c programming language, we can make many programs. We can perform many input-output operations using c programming. In today’s tutorial, we take the input numbers from the user. Then we will Generate Armstrong Numbers between the taken range with the help of the c programming language.
With the help of this program, we can Reverse equal Original.
Algorithm:-
1 2 3 4 5 6 7 8 9 |
1. Declare the variables for the program. 2. Taking the input numbers from and to by the user. 3. Calculating the <strong>Reverse equal Original</strong>. 4. Print the Result. 5. End the program. |
Program to Reverse equal Original:-
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
/* C Program to Check Reverse equal Original */ #include<stdio.h> int main() { /* Decalring the variable for the program */ int no, orig, rev=0, rem; /* Taking input from the user */ printf("Enter a number: "); /* Scanning the input from the user */ scanf("%d", &no); orig = no; /* Checking the numbers revese equal original */ while(no>0) { rem = no%10; rev = (rev*10)+rem; no = no/10; } /* printing the result if condition is true */ if(orig==rev) printf("\nThis number is equal to its Reverse"); /* printing the result if condition is false */ else printf("\nThis number is not equal to its Reverse"); getch(); return 0; } |
Output:-
In the above program, we have first initialized the required variable.
- no = it will hold the integer value.
- orig = it will hold the integer value.
- rev = it will hold the integer value.
- rem = it will hold the integer value.
Taking the input integer number from the user.