If a five digit number is imput through the keyboard, write a program to reverse the number.


 #include<stdio.h>

void main()

{

// programwithharsh//

int num,ln,r=0;

printf("Enter a five digit number= ");

scanf("%d",&num);

// programwithharsh//

ln=num%10;

r=r*10+ln;

num=num/10;

// programwithharsh//

ln=num%10;

r=r*10+ln;

num=num/10;

// programwithharsh//

ln=num%10;

r=r*10+ln;

num=num/10;

// programwithharsh//

ln=num%10;

r=r*10+ln;

num=num/10;

// programwithharsh//

ln=num%10;

r=r*10+ln;

num=num/10;

// programwithharsh//

printf("The reversed number = %d",r);

}

Post a Comment (0)
Previous Post Next Post