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
Do pointers store the address of value or the actual value of a variable?
Explain about the functions strcat() and strcmp()?
List at least 10 sorting methods indicating their average case complexity, worst case complexity and best case complexity.
Explain how can you avoid including a header more than once?
#include main() { char s[] = "Bouquets and Brickbats"; printf(" %c, ",*(&s[2])); printf("%s, ",s+5); printf(" %s",s); printf(" %c",*(s+2)); }
How many identifiers are there in c?
What is the equivalent code of the following statement in WHILE LOOP format?
What is scope of variable in c?
Which is better pointer or array?
Why isn't any of this standardized in c? Any real program has to do some of these things.
Why c language is called c?
What is the code for 3 questions and answer check in VisualBasic.Net?
What are structural members?
What is ## preprocessor operator in c?
What is a class c rental property?