Reverse Number Code in C

By | July 12, 2019

Task: Reverse Number Code in C- Write a C Program to input number and print the number in Reverse. If the user enters a number =123, the program will print its reverse number 321.

The Source Code of Reverse Number Program in C

// Write a C program to Enter a number at run time
// and display its Reverse Number
// For example, if you Enters number=513
// Program will show Reverse number=315
// www.EasyCodeBook.com
#include<stdio.h>
#include<conio.h>
int main()
{
	long int num,n,rev;
	printf("Enter an Integer Number:");
	scanf("%ld",&num);
	rev=0;
	for(n=num;n!=0;n=n/10)
	rev=(10*rev)+n%10;
	printf("Actual Number: %ld\n",num);
	printf("Reverse Number: %ld\n",rev);
	return 0;
}

Loading

Leave a Reply

Your email address will not be published. Required fields are marked *