Code for reversing of a number(Using while loop)

Code for reversing of a number(Using while loop)

#include<stdio.h>
#include<conio.h>
void main()
{
    int r=0,c,n;
    printf("Enter any number");
    scanf("%d",&n);
    while(n>0)
    {
     c=n%10;
     n=n/10;
     r=r*10+c;
    }
    printf("Reverse=%d",r);
    getch();
}


Output


Comments

Popular posts from this blog

Code for pattern 6

Code to check leap year