Solution in C to reverse an integer


  • 0
    G
    #include<stdio.h>
    #include<conio.h>
    void main()
    {
     int rem ,n , rev=0 ;
    printf("\n Enter an integer ");
    scanf("%d",&n);
    while(n)
    {
     rem=n%10;
     rev=rev*10+rem;
     n=n/10;
    }
    printf("\n The reverse integer is %d",rev);
    getch();
    }
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.