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

What are the two types of functions in c?

575


What are types of functions?

571


How do I use strcmp?

647


Compare interpreters and compilers.

642


In C language, the variables NAME, name, and Name are all the same. TRUE or FALSE?

774






Explain which of the following operators is incorrect and why? ( >=, <=, <>, ==)

612


In a header file whether functions are declared or defined?

633


Can math operations be performed on a void pointer?

593


Explain what is the difference between functions abs() and fabs()?

628


Compare and contrast compilers from interpreters.

687


Is return a keyword in c?

604


What is scanf () in c?

668


What is use of #include in c?

606


Explain what is the benefit of using #define to declare a constant?

614


In this problem you are to write a program that will cut some number of prime numbers from the list of prime numbers between 1 and N.Your program will read in a number N; determine the list of prime numbers between 1 and N; and print the C*2 prime numbers from the center of the list if there are an even number of prime numbers or (C*2)-1 prime numbers from the center of the list if there are an odd number of prime numbers in the list.

1386