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
What do you mean by Recursion Function?
Explain how do you list a file’s date and time?
What is a far pointer in c?
How can you tell whether a program was compiled using c versus c++?
What is the general form of a C program?
in ‘C’ language for Matrix Multiplication fails” Introspect the causes for its failure and write down the possible reasons for its failure.
What is structure data type in c?
What is the difference between formatted&unformatted i/o functions?
How many levels deep can include files be nested?
What is the difference between text and binary i/o?
Explain with the aid of an example why arrays of structures don’t provide an efficient representation when it comes to adding and deleting records internal to the array.
What is the advantage of a random access file?
What is structure padding in c?
string reverse using recursion
What is the difference between array and pointer?