Hi,
This has been discussed ealier, but i would like to know how the loop executes
1. #include<stdio.h>
2. #include<conio.h>
3. void main()
4. {
5. int x,y,z;
6. scanf("%d",&x);
7. if(x>0)
8. {
9. y=x/10;
10 z=x%10;
11. x=y;
12. printf("%d",z);
13. }
14. printf("%d",x);
15. }
Suppose I enter 321
y will become 32
z will become 1
x will be 32
It will print first z which is 1
then it will print x which is 32
But it should have been 123 ( Reverse of 321)