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


Please Help Members By Posting Answers For Below Questions

Explain what could possibly be the problem if a valid function name such as tolower() is being reported by the c compiler as undefined?

573


Explain can you assign a different address to an array tag?

634


What is an auto variable in c?

742


a c code by using memory allocation for add ,multiply of sprase matrixes

2290


What is the difference between a string and an array?

700






What is difference between stdio h and conio h?

874


c language interview questions & answer

1452


How do you redirect a standard stream?

615


Did c have any year 2000 problems?

647


please explain every phase in the "SDLC" in the dotnet.

2173


How will you write a code for accessing the length of an array without assigning it to another variable?

609


Write a program of advanced Fibonacci series.

700


What are multidimensional arrays?

648


What is the mean of function?

640


What is function prototype in c language?

606