GeeksforGeeks » Interview Questions

reverse a number

(3 posts)

Tags:

  1. ravneet
    guest
    Posted 5 months ago #

    how to reverse a number in c without the use of any function

  2. TENNO
    guest
    Posted 5 months ago #

    #include <stdio.h>
    int main()
    {
    	int num , res= 0;
    	scanf("%d",&num);
    	do
    	{
    		res = res * 10 + num % 10;
    	}while (num/=10);
    	printf("%d\n", res);
    }
    
  3. Saurabh
    guest
    Posted 5 months ago #

    perfect solution


Reply

You must log in to post.

RSS feed for this topic