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
Differentiate between a for loop and a while loop? What are it uses?
What does %2f mean in c?
The process of repeatedly running a set of computer instructions until some condition is specifed a) condition b) sequential condition c) global d) iteration
what is a NULL Pointer? Whether it is same as an uninitialized pointer?
What are the Advantages of using macro
Why cant I open a file by its explicit path?
How can you pass an array to a function by value?
What are the advantages of the functions?
What are the difference between a free-standing and a hosted environment?
What is hungarian notation? Is it worthwhile?
Define C in your own Language.
What functions are used in dynamic memory allocation in c?
What is the difference between if else and switchstatement
Explain what will the preprocessor do for a program?
Why should I prototype a function?