C program to reverse a number
C program to reverse a number, in this program we are given a number and we will reverse it, it is a simple program that is most commonly asked. It is a short program that is mostly used as a little part in big programs, we will use two integer type variables to make this program.
C program to reverse a number, in this program we are given a number and we will reverse it, it is a simple program that is most commonly asked. It is a short program that is mostly used as a little part in big programs, we will use two integer type variables to make this program.
Description of c program to reverse a number
We will take two integer type variables 'n' and 'reverse' with initial value 0, we will first ask the user to insert a number and will store it in 'n', then will use while loop for the condition 'n!=0' then will multiply reverse with 10 and store it in reverse only. In next step we will 'n%10' to reverse and again store the value in reverse and finally divide the n by 10 and store in n and will print it as output.
C program to reverse a number
output
This is how we can make a c program to reverse a number.


ConversionConversion EmoticonEmoticon