Print all the palindrome numbers.If a number is not
palindrome make it one by attaching the reverse to it.
eg:123
output:123321 (or) 12321
Answer Posted / kifle tadesse (mekelle institu
1.# include<stdio.h>
2. int main()
3. {
4. int n,n1,rem,rev=0;
5. printf("enter the number u want to reverse\n");
6. scanf("%d",&n);
7.n1=n;
8. while(n>0)
9.{
10. rem=n%10;
11. rev=rev*10+rem;
12. n=n/10;
13. }
14. if(n1==rev)
15. printf("the given no is palindrome");
16. else
17. {
18. printf("no is not palindrome\n");
19. printf(" its palindrome by attaching it's reverse is
%d%d\n",n1,rev);
20. }return 0;
21. }
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
Why doesnt this code work?
What is #line in c?
Write a code to determine the total number of stops an elevator would take to serve N number of people.
What is adt in c programming?
What is the difference between far and near ?
Explain what happens if you free a pointer twice?
What are the functions to open and close file in c language?
write a program that reads lines(using getline), converts each line to an integer using atoi, and computes the average of all the numbers read. also compute the standard deviation.
write a program that declares an array of 30 elements named "income" in the main functions. then cal and pass the array to a programmer-defined function named "getIncome" within the "getIncome" function, ask the user for annual income of 30 employees. then calculate and print total income on the screen using the following function: "void getIncome ( ai []);
What is nested structure in c?
Why clrscr is used after variable declaration?
Explain pointer. What are function pointers in C?
What is main return c?
Why shouldn’t I start variable names with underscores?
Why C language is a procedural language?