Answer Posted / mani bhowmik
void main()
{
int num, temp;
for(;;) {
printf("Enter number:");
scanf("%d",&num);
if(num == 0) break;
while(num) {
temp = num%10;
num = num/10;
printf("%d", temp);
}
printf("\n");
}
getche();
}
So any number will be reversed here. 12345 is five digit
number. Using while we can generalize the number of digits.
The continuous loop is ended when 0 is entered.
| Is This Answer Correct ? | 1 Yes | 5 No |
Post New Answer View All Answers
Can one function call another?
How can you increase the size of a statically allocated array?
How can I send mail from within a c program?
in case any function return float value we must declare a) the function must be declared as 'float' in main() as well b) the function automatically returned float values c) function before declared 'float' keyword d) all the above
what is uses of .net
What are the standard predefined macros?
Are comments included during the compilation stage and placed in the EXE file as well?
Explain the concept and use of type void.
What is the difference between union and structure in c?
What is pre-emptive data structure and explain it with example?
Explain modulus operator.
Why enum is used in c?
Array is an lvalue or not?
What is the use of extern in c?
What are structures and unions? State differencves between them.