Ask your own question, for FREE!
Computer Science 19 Online
OpenStudy (anonymous):

write a user defined function to check whether the given number is a palindrome or not.@ write a user defined function to check whether the given number is a palindrome or not.@ @Computer Science

OpenStudy (anonymous):

pls help me...

OpenStudy (anonymous):

#include<iostream.h> #include<conio.h> void main() { clrscr(); { int palindrome(int n)

OpenStudy (anonymous):

wt to do next??

OpenStudy (aravindg):

:)

OpenStudy (aravindg):

pal

OpenStudy (anonymous):

hey...:)

OpenStudy (aravindg):

:)

OpenStudy (anonymous):

pls help...

OpenStudy (aravindg):

njano?

OpenStudy (anonymous):

ohh...i havent studied that...:(

OpenStudy (aravindg):

wndrful

OpenStudy (anonymous):

poda arvind...

OpenStudy (aravindg):

NJAN HELP CHEYAMEDI

OpenStudy (anonymous):

then help pls.....:(

OpenStudy (aravindg):

http://www.twiddla.com/671191

OpenStudy (aravindg):

cm thrr

OpenStudy (aravindg):

k u knw prgrm of palindrome?

OpenStudy (anonymous):

yupz..

OpenStudy (aravindg):

pinenetha prblm?

OpenStudy (anonymous):

user defined function....idk that

OpenStudy (aravindg):

scoolil eduthile?

OpenStudy (anonymous):

cin>>num; n=num; digit =num%10; rev=(rev*10)+digit; num=num/10; while(num!=0); if(n==rev); numbr is palindrome

OpenStudy (anonymous):

lol...skul..hehe they teach-2+5 hw-23^34xi+243i exam-86^(110x)-36/23i+45^57*97^i

OpenStudy (aravindg):

???

OpenStudy (anonymous):

just kiddin ;)

OpenStudy (aravindg):

:)

OpenStudy (aravindg):

aa prgrm type cheyan kure neram pidikum

OpenStudy (anonymous):

datz okie...i'l wait

OpenStudy (aravindg):

podi eniku atrem type cheyan patila

OpenStudy (anonymous):

ehhh.....:(

OpenStudy (anonymous):

temmme u dunno...:P

OpenStudy (aravindg):

ariyamedi poti

OpenStudy (aravindg):

pkshe type cheyan samayamila sry

OpenStudy (anonymous):

heyy...b descent..k?

OpenStudy (anonymous):

k den ....will luk 4 sm1 else....

OpenStudy (anonymous):

:D

OpenStudy (aravindg):

ey i cal my gud frnds lyk tht u dnt lyk it??

OpenStudy (anonymous):

hmmm....

OpenStudy (aravindg):

?

OpenStudy (anonymous):

hey...u knw any user defined functions?? lowercase to uppercase??

OpenStudy (aravindg):

ya toupper

OpenStudy (aravindg):

bt to use tht u need to include character.h file or smthng

OpenStudy (aravindg):

string.h i think

OpenStudy (anonymous):

mmm...nt needed...din study dat chptr..

OpenStudy (farmdawgnation):

So, first thing is first. I'm assuming you're using C++ because you use "cin" in some of your code samples. So, if you already have something along the lines of: string numberstring; cin >> numberstring; And you need to determine if that is a palindrome, then you need to do something like this in a different function: for(i=0; i < (numberstring.length/2); i++) { if(numberstring[i] != numberstring[numberstring.length-i]) { return false; } } return true; Granted, I'm not a C/C++ programmer primarily, so you'll likely need to do some adjustments for off-by-one errors. But the general idea is to use one loop to check the string from both ends at the same time. Because it's a string, you can do that. If you're required to start with an integer, then you'll need to do some conversion before that loop will work.

OpenStudy (anonymous):

what does return false , return true mean??

OpenStudy (farmdawgnation):

Well, the assumption was that this code would be inside some function that returns a boolean value (true/false value). So, true would mean the number is a palindrome, false would mean the number isn't a palindrome. You can replace those lines with whatever else makes sense for your particular program.

OpenStudy (anonymous):

k...tnk u :)

OpenStudy (anonymous):

Hi i want 1 simple Question answers Write a program that uses function digit(N,k) that return the value of the kth digit from the right of the number N. For eg. The function call digit (254693,2) should return 9.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!