Chapter - 2: C Instructions

If a five-digit number is input through the keyboard, write a program to reverse the number.


H
Sections
2
Exercises

A

B

C

D

E

F

G

H

1

2

3

4

5

6

7

8

9

10

#include<stdio.h>
#include<conio.h>
int main()
{
	int num,a,b,c,d,e;
	printf("Enter a five digit number : ");
	scanf("%d", &num);
	e=num%10;
	d=(num/10)%10;
	c=(num/100)%10;
	b=(num/1000)%10;
	a=(num/10000);
	num = e*10000+d*1000+c*100+b*10+a;
	printf("\n%d", num);
	getch();
	return 0;
}

© 2020 Garbage Valuegarbage value logo