Program in C to swap the three digit number

Write a program in C to swap the three digit number

#include<stdio.h>
#include<conio.h>

void main ()
{
          int b,r,n,r1,r2;
          clrscr ();
          printf ("Enter the Value: ");
          scanf ("%d",&n);
          r=n%10;
          n=n/10;
          r1=n%10;
          n=n/10;
          r2=n%10;
          n=n/10;
          b=(r*100)*(r2*10)+(r2);
          printf ("%d%d%d",r,r1,r2);
          getch ();
}


Post a Comment