187k views
0 votes
Write a non-stop multi-function program to do the following taks:

1.Function program to generate a list of palindrome numbers starting from 10 to n.
Write code in c program

User Hilikus
by
8.2k points

1 Answer

6 votes

Answer:

#include <stdio.h>

int isPalindrome(int num) {

int rev = 0, temp = num;

while(temp) {

rev = rev * 10 + (temp % 10);

temp /= 10;

}

return (num == rev);

}

void palindromeList(int n) {

printf("List of palindrome numbers from 10 to %d:\\", n);

for(int i=10; i<=n; i++) {

if(isPalindrome(i)) {

printf("%d ", i);

}

}

}

int main() {

int n;

printf("Enter an integer (n >= 10): ");

scanf("%d", &n);

palindromeList(n);

return 0;

}

Step-by-step explanation:

User Omilus
by
8.0k points