Reverse Integer in C Language using Modulo

#include<stdio.h> 

void main() {
	int n;
	int mod; 
	int rev = 0; 
	
	printf("ENTER AN INTEGER: "); 
	scanf("%d", &n); 
	
	while( n > 0 ) { 				
		mod = n % 10; 			
		rev = rev * 10 + mod;
		n = n / 10; 		
	}
	
	printf("REVERSED: %d\n", rev);
}


syntax highlighting w/ c language.

Post new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.