×
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
2027    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.
Albert Einstein
If you can't explain it simply, you don't understand it well enough.
Albert Einstein
4340
84.76
Today So Far
Total View (Lakh)
softetechnologies
26/05/2018     54745
25/06/2018     45855
01/01/2018     44067
28/06/2017     41613
02/08/2017     40711
01/08/2017     34709
06/07/2017     34485
15/05/2017     33700
11/09/2018     31260
14/07/2017     30568
softetechnologies