×
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
1306    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.
Swami Vivekananda
What makes one man great and another weak and low is shraddha (concentration).
Swami Vivekananda
1374
59.47
Today So Far
Total View (Lakh)
softetechnologies
26/05/2018     44336
01/01/2018     36726
25/06/2018     36300
28/06/2017     34765
02/08/2017     33320
01/08/2017     27720
06/07/2017     27482
15/05/2017     27080
14/07/2017     22796
11/09/2018     21441
softetechnologies