/* Reverse number using while loop */
#include<stdio.h>
int main()
{
int a, s;
printf("Enter value of a: ");
scanf("%d",&a);
s = 0;
while(a > 0)
{
s = s*10;
s = s + (a%10);
a = a / 10;
}
printf("Reverse number is: %d",s);
return 0;
}
Related Post:
Reverse number using for loop
http://cbasicprogram.blogspot.in/2012/02/reverse-number-using-for-loop.html
#include<stdio.h>
int main()
{
int a, s;
printf("Enter value of a: ");
scanf("%d",&a);
s = 0;
while(a > 0)
{
s = s*10;
s = s + (a%10);
a = a / 10;
}
printf("Reverse number is: %d",s);
return 0;
}
Related Post:
Reverse number using for loop
http://cbasicprogram.blogspot.in/2012/02/reverse-number-using-for-loop.html
Sir i can't understand your logic,
ReplyDeletewhy you are use
"s = s*10;"
please help me before my exam
Nothing the sum value should be assigned and multiplyed with 10
DeleteAttention everyone, the file provided above is not working. I have been looking for the working file and finally found it.
Delete✔️Click Here To Download http://gestyy.com/e0GAyS
✔️Click Here To Download
✔️Click Here To Download http://exe.io/XONVsO6l
✔️Click Here To Download
✔️Click Here To Download
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Mn.
..
.
.
.
..
.
.
.
.
.
.
.
.
.
.
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.cx
.cx
.
.sdcccxxx
Write a program that reads N integers, determines how many positive and negative values have been read and computes the total and average of input values
ReplyDeletewhy while loop is use here ?? why for loop not use'
ReplyDeleteyou can do it by for and while loop.even using do while loop.
ReplyDeletesir i cant understand how a is printed there??
ReplyDeletePlease explain the while statement
ReplyDeletes = s*10;
s = s + (a%10);
a = a / 10;
There is no any meaning of logic .wrong program
ReplyDeletehttps://maytinhtrananh.vn/sua-may-tinh-may-in.html
ReplyDeletehttps://phalebinhminh.com