Question

Write a program to take input of two integer variable a and b. After taking input...

Write a program to take input of two integer variable a and b. After taking input of these variables print all the palindrome numbers from a to b. I need this is C programming language.

Homework Answers

Answer #1
#include <stdio.h>

int main() {
    int a, b, i, num, reverse;
    printf("Enter first integer: ");
    scanf("%d", &a);
    printf("Enter second integer: ");
    scanf("%d", &b);
    printf("Palindromic numbers in the given range are\n");
    for (i = a; i <= b; ++i) {
        num = i;
        reverse = 0;
        while (num > 0) {
            reverse *= 10;
            reverse += num % 10;
            num /= 10;
        }
        if (i == reverse) {
            printf("%d\n", i);
        }
    }
    return 0;
}
Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
C programming language. Write a program to print reverse of all the numbers from m to...
C programming language. Write a program to print reverse of all the numbers from m to n using functions with arguments and no return type. The inputs in the program will be m and n variables and need to take these variables as arguments.
Write a program that mimics a calculator. The program should take as input two integer and...
Write a program that mimics a calculator. The program should take as input two integer and an arithmetic operation (+, -, *, /, %) to be performed. It should then output the numbers the operator and the result. Division by zero??
Write a full C++ program to read a series of integer numbers from standard input and...
Write a full C++ program to read a series of integer numbers from standard input and print them out in reverse order, one per line. You may assume that there will be a minimum of 2 numbers to read and a maximum of 200.
write a C program that declares an integer variable called "favorite_number". The program should then prompt...
write a C program that declares an integer variable called "favorite_number". The program should then prompt the user to enter their favorite number, and use scanf to read the user's input into favorite_number. Finally, the program should print a message that includes the user's input.
Write a program to input 6 numbers. After each number is input, print the biggest of...
Write a program to input 6 numbers. After each number is input, print the biggest of the numbers entered so far. Please use python and include a screenshot that the code is running. Please use simple code as I am only a high school student.
Write a program that takes in an integer in the range 20-98 as input. The output...
Write a program that takes in an integer in the range 20-98 as input. The output is a countdown starting from the integer, and stopping when both output digits are identical. I already did the coding part:num = int(input()) if 20 <= num <= 98: while num % 11!=0: print(num) num -= 1 print(num) else: print('Input must be 20-98') Question: How do you know when to use %? Why is it %11 and why not %12 or %15? How do...
In R- Studio : Write a function that takes as an input a positive integer and...
In R- Studio : Write a function that takes as an input a positive integer and uses the print() function to print out all the numbers less than the input integer. (Example: for input 5, the function should print the numbers 1,2,3,4 { for input 1, the function should not print a number.) Write a recursive function, do not use any of the loop commands in your code.
write a MIPS assembly program to get an integer input from the user and multiply it...
write a MIPS assembly program to get an integer input from the user and multiply it by 2 and print output to the console
Write a program to input a sequence of 8 integers, count all the odd numbers and...
Write a program to input a sequence of 8 integers, count all the odd numbers and sum all the negative integers. One integer is input and processed each time around the loop. Python Programming
All in C language... Write a complete program that declares an integer variable, reads a value...
All in C language... Write a complete program that declares an integer variable, reads a value from the keyboard into that variable, and writes to standard output the variable's value, twice the value, and the square of the value, separated by spaces. Besides the numbers, nothing else should be written to standard output except for spaces separating the values. I got this... and it's wrong #include<stdio.h> int main() { int num; scanf("%d", &num); printf("%d %d %d",num,2*num,num*num); return 0; }
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT