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 are the two types of functions in c?
What are types of functions?
How do I use strcmp?
Compare interpreters and compilers.
In C language, the variables NAME, name, and Name are all the same. TRUE or FALSE?
Explain which of the following operators is incorrect and why? ( >=, <=, <>, ==)
In a header file whether functions are declared or defined?
Can math operations be performed on a void pointer?
Explain what is the difference between functions abs() and fabs()?
Compare and contrast compilers from interpreters.
Is return a keyword in c?
What is scanf () in c?
What is use of #include in c?
Explain what is the benefit of using #define to declare a constant?
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.