reverse three digit number

C program to find the reverse of three digit number without using any control control structure.

/*reverse three digit number*/

#include <stdio.h>

int main()

{
int num,d;

printf(“Enter three digit number\n”);

scanf(“%d”, &num);

d=num/10;

num=((num%10)*100 + (d%10)*10 + d/10);

printf(“the reverse three digit number is \n%d\n”, num);

return 0;

}

Output
Enter three digit number
432
the reverse three digit number is
234

Enter three digit number
798
the reverse three digit number is
897

Leave a Reply

Your email address will not be published. Required fields are marked *