palindrome for strings and numbers----Can anybody do the
prog?
Answer Posted / sree
#include<stdio.h>
void main
{
int n,t,d,r;
printf("Enter the number:");
scanf("%d",&n);
t=n;
while(n>=1)
{
d=n%10;
r=(r*10)+d;
n=n/10;
}
if(t==r)
printf("Palindrome");
else
printf("Not a palindrome");
}
| Is This Answer Correct ? | 3 Yes | 3 No |
Post New Answer View All Answers
Which is not valid in C a) class aClass{public:int x;}; b) /* A comment */ c) char x=12;
What is New modifiers?
Differentiate call by value and call by reference?
What does #pragma once mean?
What functions are used in dynamic memory allocation in c?
Can a pointer be volatile in c?
When should the const modifier be used?
What is difference between structure and union in c?
Explain what is the difference between text files and binary files?
What is sizeof c?
How can a program be made to print the line number where an error occurs?
Explain how do you print only part of a string?
Why c is called a mid level programming language?
Is it acceptable to declare/define a variable in a c header?
What are near, far and huge pointers?