×
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
1643    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
If you want to go east, don't go west.
Sri Sri Ramakrishna Paramahamsa
3298
72.84
Today So Far
Total View (Lakh)
softetechnologies
26/05/2018     51893
25/06/2018     43741
01/01/2018     42836
28/06/2017     40566
02/08/2017     39380
01/08/2017     33592
06/07/2017     33345
15/05/2017     32704
14/07/2017     28926
11/09/2018     28750
softetechnologies