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 mit
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);
7n1=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 ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is the difference between formatted&unformatted i/o functions?
Which control loop is recommended if you have to execute set of statements for fixed number of times?
What is time null in c?
What is a pointer in c?
Explain what does it mean when a pointer is used in an if statement?
Explain what is a 'null pointer assignment' error? Explain what are bus errors, memory faults, and core dumps?
how can f be used for both float and double arguments in printf? Are not they different types?
What is a sequential access file?
What is the value of uninitialized variable in c?
Is python a c language?
Why void main is used in c?
What is the main difference between calloc () and malloc ()?
What is %d called in c?
What does return 1 means in c?
What is use of bit field?