×
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
1032    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.
Mahatma Gandhi
By education, I mean all-around drawing of the best in child and man in body, mind and sprit.
Mahatma Gandhi
3551
51.71
Today So Far
Total View (Lakh)
softetechnologies
26/05/2018     41742
01/01/2018     35913
28/06/2017     33954
25/06/2018     33200
02/08/2017     32305
06/07/2017     26716
01/08/2017     26706
15/05/2017     26325
14/07/2017     21729
21/04/2018     20622
softetechnologies