write program for palindrome
Answer Posted / rupamrox
#include<stdio.h>
#include<conio.h>
main()
{
int n,m,p,rev;
clrscr();
printf("enter a number: ");
scanf("%d",&n);
p=n;
rev=0;
while(n>0)
{
m=n%10;
rev=rev*10+m;
n=n/10;
}
if(rev==p)
printf("%d is palindrome",p);
else
printf("%d is not palindrome",p);
getch();
}
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
What is heap sort in c++?
What do you mean by ‘void’ return type?
Write about a nested class and mention its use?
Why would you use pointers in c++?
What is data hiding c++?
Why is c++ still best?
If we want that any wildcard characters in the command line arguments should be appropriately expanded, are we required to make any special provision? If yes, which?
What is prototype in c++ with example?
What is the equivalent of Pascal's Real a) unsigned int b) float c) char
What gives the current position of the put pointer?
Define what is constructor?
What are the uses of typedef in a program?
Am studying basic c++ programming, have been given the following assignment. Design a linear program to calculate the maximum stress a material can withstand given a force and a diameter of a circle. To find the required area pi should be defined. Have most of the program sorted out but am at a loss as to how to show the calculations required. Can anyone help?
What can I safely assume about the initial values of variables which are not explicitly initialized?
How do you declare A pointer to function which receives an int pointer and returns a float pointer