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

where are auto variables stored? What are the characteristics of an auto variable?

824


What are all different types of pointers in c?

763


By using C language input a date into it and if it is right?

796


Stimulate calculator using Switch-case-default statement for two numbers

2683


#define PRINT(int) printf("int = %d ",int) main() {< BR> intx,y,z; x=03;y=02;z=01; PRINT(x^x); z<<=3;PRINT(x); y>>=3;PRINT(y); }

942


How can I display a percentage-done indication that updates itself in place, or show one of those twirling baton progress indicators?

783


What is sorting in c plus plus?

739


Sir,please help me out with the code of this question. Write an interactive C program that will encode or decode multiple lines of text. Store the encoded text within a data file, so that it can be retrieved and decoded at any time. The program should include the following features: (a) Enter text from the keyboard, encode the text and store the encoded text in a data file. (b) Retrieve the encoded text and display it in its encoded form. (c) Retrieve the encoded text, decode it and then display the decoded text. (d) End the computation. Test the program using several lines of text of your choice.

2010


What are directives in c?

733


please can any one suggest me best useful video tutorials on c i am science graduate.please help me.u can email me to sas29@in.com

1553


Why is a semicolon (;) put at the end of every program statement?

826


Which node is more powerful and can handle local information processing or graphics processing?

1068


What is f'n in math?

820


What is the purpose of clrscr () printf () and getch ()?

784


Explain pointers in c programming?

851