write a program to display reverse of a number using for
loop?
Answer Posted / hema
int main()
{
int a = 234;
printf("\n");
while( a != 0)
{
printf("%d",a%10);
a /= 10;
}
return 0;
}
______________________________________________________
use below program if you want to store value in another
variable
______________________________________________________
int main()
{
int a = 234;
int b = 0;
printf("\n");
while( a != 0 )
{
b = b *10 + (a%/10);
a /= 10;
}
printf("\n values in revers order= %d \n",b);
return 0;
}
| Is This Answer Correct ? | 22 Yes | 11 No |
Post New Answer View All Answers
What is the difference between exit() and _exit() function in c?
Can I use base-2 constants (something like 0b101010)? Is there a printf format for binary?
What is the difference between mpi and openmp?
What are the rules for identifiers in c?
Explain indirection?
What is the difference between volatile and const volatile?
Combinations of fibanocci prime series
Is c easier than java?
Is there any algorithm to search a string in link list in the minimum time?(please do not suggest the usual method of traversing the link list)
why wipro wase
What is quick sort in c?
How can I manipulate strings of multibyte characters?
Explain how can I pad a string to a known length?
Write a C program in Fibonacci series.
Can we access the array using a pointer in c language?