16.WAP to reverse last 2 digits of a given number.
#include<stdio.h>
int
number,last_digit,second_last_digit;
void
main()
{
printf("Enter a number whose last
2 digits needs to be reversed : ");
scanf("%d",&number);
last_digit=number%10;
number=number/10;
second_last_digit=number%10;
number=number/10;
//printf("%d
%d",last_digit,second_last_digit);
number = number * 10 + last_digit;
number = number * 10 +
second_last_digit;
printf("The reversed number is :
%d\n",number);
}
Comments
Post a Comment