C Program to print the reverse number of a given four-digit number

Here, this program below prints the reverse of any given number in C. We perform the following operations using arithmetic operators.

#include<stdio.h>
int main(){
	int r1, r2, r3, n, rev;
	printf("Enter any four digit number");
	scanf("%d", &n);
	r1=n%10;
	n=n/10;
	r2=n%10;
	n=n/10;
	r3=n%10;
	n=n/10;
	rev=r1*1000+r2*100+r3*10+n;
	printf("Reverse of the given 4 digit numbers= %d", rev);
}

The above code generates its output as below:

SHARE C Program to print the reverse number of a given four-digit number

You may also like...

Leave a Reply

Your email address will not be published.


Warning: Undefined variable $category in /www/wwwroot/followtutorials.com/wp-content/themes/hueman/sidebar_tutorial.php on line 10

Warning: Trying to access array offset on null in /www/wwwroot/followtutorials.com/wp-content/themes/hueman/sidebar_tutorial.php on line 10

Warning: Attempt to read property "category_parent" on null in /www/wwwroot/followtutorials.com/wp-content/themes/hueman/sidebar_tutorial.php on line 10
Share