×
FREE ASSISTANCE FOR THE INQUISITIVE PEOPLE
Tutorial Topics
X
softetechnologies
C function to reverse a string and find the smallest divisor of an integer - WBUT MAKAUT MCA 2012 Different function for File Handling and spiting a text file - WBUT MAKAUT MCA 2012
Reverse the digits of an integer - WBUT MAKAUT MCA 2012 - C Language
1976    Arnab De    11/04/2020

Write a C function to reverse the digits of an integer.

If we divide a integer number by 10. Then the reminder will be the last digit of the number and result will be the remaining digit.

let the number is 1234.
then 1234 % 10 = 4
and 1234 / 10 = 123

void main()
{
	int no,s=0;
	printf("Enter a number");
	scanf("%d",&no);
	while(no>0)
	{
		s=s*10+(no%10);
		no /=10;
	}
	printf("Reverse No Is %d",s);
}
C function to reverse a string and find the smallest divisor of an integer - WBUT MAKAUT MCA 2012 Different function for File Handling and spiting a text file - WBUT MAKAUT MCA 2012
softetechnologies
Author Details
Arnab De
I have over 16 years of experience working as an IT professional, ranging from teaching at my own institute to being a computer faculty at different leading institute across Kolkata. I also work as a web developer and designer, having worked for renowned companies and brand. Through tutorialathome, I wish to share my years of knowledge with the readers.
Enter New Comment
Comment History
No Comment Found Yet.
Sri Sri Ramakrishna Paramahamsa
Have love for everyone, no one is other than you.
Sri Sri Ramakrishna Paramahamsa
880
82.66
Today So Far
Total View (Lakh)
softetechnologies
26/05/2018     54443
25/06/2018     45509
01/01/2018     43889
28/06/2017     41409
02/08/2017     40481
01/08/2017     34486
06/07/2017     34267
15/05/2017     33505
11/09/2018     30742
14/07/2017     30235
softetechnologies