convert 12345 to 54321 withoutusing strig

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


Please Help Members By Posting Answers For Below Questions

Do pointers store the address of value or the actual value of a variable?

700


Explain about the functions strcat() and strcmp()?

691


List at least 10 sorting methods indicating their average case complexity, worst case complexity and best case complexity.

2395


Explain how can you avoid including a header more than once?

687


#include main() { char s[] = "Bouquets and Brickbats"; printf(" %c, ",*(&s[2])); printf("%s, ",s+5); printf(" %s",s); printf(" %c",*(s+2)); }

772






How many identifiers are there in c?

672


What is the equivalent code of the following statement in WHILE LOOP format?

895


What is scope of variable in c?

654


Which is better pointer or array?

696


Why isn't any of this standardized in c? Any real program has to do some of these things.

756


Why c language is called c?

655


What is the code for 3 questions and answer check in VisualBasic.Net?

1782


What are structural members?

669


What is ## preprocessor operator in c?

706


What is a class c rental property?

735