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: