how to write palindrome program?
Answers were Sorted based on User's Feedback
Answer / a.prathyusha
#include<stdio.h>
void main()
{
int n,s=0,r,n1;
printf("enter any number:");
scanf("%d",&n);
n1=n;
while(n>0)
{
r=n%10;
s=(s*10)+r;
n=n/10;
}
if(s==n1)
printf("palindrom");
else
printf("not palindrom");
}
| Is This Answer Correct ? | 7 Yes | 1 No |
Answer / arnab
#include<iostream.h>
#include<conio.h>
void main()
{ int num, num1, rem, rev=0;
cin>>num;
num1=num;
while(num!=0)
{
rem=num%10;
rev=rev*10+rem;
num=num/10;
}
if(num1==rev)
cout<<"yes the no. is pallindrome";
else
cout<<"no the no. is not pallindrome";
getch();
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / shweta
when we do reverse any no then we find a new no and this
no is equal to our privous no,which is called palindrom no.
by program
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int n,m,sum=0,l;
printf("enter any no");
scanf("%d",&n);
while(n>0)
{
m=n%10;
sum=sum*10+m;
n=n\10;
}
if(n==l)
{
printf("no is palindrom");
}
else
{
printf("no is not palindrom");
}
getch();
}
| Is This Answer Correct ? | 2 Yes | 5 No |
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 []);
hi any body pls give me company name interview conduct "c" language only
which do you prefer C or Pascal?
Explain how do you generate random numbers in c?
what is difference between ++(*p) and (*p)++
17 Answers Accenture, HCL, IBM,
What language is c written?
How to reverse a string using a recursive function, without swapping or using an extra memory?
31 Answers Cisco, Mind Tree, Motorola, Ophio, Sony, TCS, Wipro,
Mention four important string handling functions in c languages .
Explain Function Pointer?
what are threads ? why they are called light weight processes ? what is the relation between process and threads ?
Program to find the sum of digits of a given number until the sum becomes a single digit. (e.g. 12345=>1+2+3+4+5=15=>1+5=6)
int main() { int *p=new int; *p=10; del p; cout<<*p; *p= 60; cout<<*p; } what will be the output & why?