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
How can I get random integers in a certain range?
Explain what does it mean when a pointer is used in an if statement?
Is there anything like an ifdef for typedefs?
Why is c not oop?
What's a good way to check for "close enough" floating-point equality?
What are pointers? What are stacks and queues?
Explain the meaning of keyword 'extern' in a function declaration.
How many loops are there in c?
What is property type c?
What extern c means?
What is extern variable in c with example?
Explain what is a program flowchart and explain how does it help in writing a program?
Explain the bubble sort algorithm.
i have a written test for microland please give me test pattern
Write a program to swap two numbers without using third variable in c?