Reverse the number without using loop in C?

In this section you will learn how to reverse three numbers in c without using loop. We will use two variable for reverse the numbers. Just simple mathematic operation we will perform to reverse the number. In this program we are taking the input from user.

Reverse Number Program without Loop

Reverse mean shifting the first value to last value and shifting the last value to first value.

Let’s suppose a user will input a number ‘386’, then we will perform reverse operation on it.

How program will work?

Program of reverse three digit number without using loop in c.


	#include<stdio.h>
	#include<conio.h>
		
	//PROGRAM OF REVERS THREE DIGIT NUMBER WITHOUT LOOP
	void main()
	{
		int num, temp;
		clrscr();
		
		printf("ENTER THE THREE DIGIT NUMBER:- ");
		scanf("%d",&num);
		
		printf("AFTER REVERSE RESULT IS:- ");
		temp = num%10;
		printf("%d",temp);
		temp = num/10;
		temp = temp%10;
		printf("%d",temp);
		temp = num/10;
		temp = temp/10;
		printf("%d",temp);

		getch();
	}
	

Output:


	ENTER THE THREE DIGIT NUMBER:- 386
	AFTER REVERS NUMBER IS:- 683

Post Your Comment