i can hardly know what is the code for this. I have researched palindromes, but unfortunately, I only have read about integers not for characters..I need some help.. 9 4006 i can hardly know what is the code for this. I have researched palindromes, but unfortunately, I only have read about integers not for characters..I need some help..
There are many ways of doing this.
Surely you must have an idea of your own on how to do it? Let's start with the more difficult one. If you were told to this this by making use of a char array, how would you do it?
i can hardly know what is the code for this. I have researched palindromes, but unfortunately, I only have read about integers not for characters..I need some help..
Are you trying to write a code to reverse a string or to check if a given word is a palindrome?
As far as I know a palindrome is a word, phrase, verse, or sentence that reads the same backward or forward.
Eg: Dad, Madam, "fall leaves after leaves fall" etc
well I am not sure if this can be called a plaindrome
"fall leaves after leaves fall"
I am putting some more examples... Don't nod
Dogma: I am God
Never odd or even
Too bad – I hid a boot
Rats live on no evil star
No trace; not one carton
Was it Eliot's toilet I saw?
Murder for a jar of red rum
May a moody baby doom a yam?
Go hang a salami; I'm a lasagna hog!
Satan, oscillate my metallic sonatas!
A Toyota! Race fast... safe car: a Toyota
Straw? No, too stupid a fad; I put soot on warts
Are we not drawn onward, we few, drawn onward to new era?
Doc Note: I dissent. A fast never prevents a fatness. I diet on cod
No, it never propagates if I set a gap or prevention
Anne, I vote more cars race Rome to Vienna
Sums are not set as a test on Erasmus
Kay, a red nude, peeped under a yak
Some men interpret nine memos
Campus Motto: Bottoms up, Mac
Go deliver a dare, vile dog!
Madam, in Eden I'm Adam
Oozy rat in a sanitary zoo
Ah, Satan sees Natasha
Lisa Bonet ate no basil
Do geese see God?
God saw I was dog
Dennis sinned
Are you trying to write a code to reverse a string or to check if a given word is a palindrome?
As far as I know a palindrome is a word, phrase, verse, or sentence that reads the same backward or forward.
Eg: Dad, Madam, "fall leaves after leaves fall" etc
"fall leaves after leaves fall"
well I am not sure if this can be called a plaindrome
Word palindromes are sentences that are read in either direction word by word.
Eg:
First ladies rule the state, and state the rule,"Ladies First."
Fall leaves after leaves fall.
Ref:-
You can find the above examples under 'Symmetry by words' in http://en.wikipedia.org/wiki/Palindrome
Alright then. I'll copy this to the cafe forum.
- import java.io.*;
-
public class Pal
-
{
-
public static void main (String args[])throws Exception
-
{
-
String character;
-
//char word;
-
char[] temp;
-
temp = new char[15];
-
char i;
-
-
System.out.println("Input word:");
-
for (i=0;i<14;i--)
-
{
-
InputStreamReader word= new InputStreamReader(System.in);
-
BufferedReader word2=new BufferedReader(word);
-
character=word2.readLine();
-
//character=String.parseInt(character);
-
//temp[i]=character;
-
}
-
//System.out.println ("Palindrome: ");
-
for (i=0;i<14;--i)
-
{
-
System.out.print ("Palindrome: "+temp[i]);
-
}
-
}
-
}
That is my code.My problem is that, how can I make the user's word input to its opposite word? Example: He inputs MILK.. The output shoud be KLIM.
Please help!
- import java.io.*;
-
public class Pal
-
{
-
public static void main (String args[])throws Exception
-
{
-
String character;
-
//char word;
-
char[] temp;
-
temp = new char[15];
-
char i;
-
-
System.out.println("Input word:");
-
for (i=0;i<14;i--)
-
{
-
InputStreamReader word= new InputStreamReader(System.in);
-
BufferedReader word2=new BufferedReader(word);
-
character=word2.readLine();
-
//character=String.parseInt(character);
-
//temp[i]=character;
-
}
-
//System.out.println ("Palindrome: ");
-
for (i=0;i<14;--i)
-
{
-
System.out.print ("Palindrome: "+temp[i]);
-
}
-
}
-
}
That is my code.My problem is that, how can I make the user's word input to its opposite word? Example: He inputs MILK.. The output shoud be KLIM.
Please help!
Get the word as a string with the readline method. No need for a for loop for that.
Then get its length using the string.length() method. After that you can now form a string by adding characters from the last to the first using a for loop.
example codes of palindrome in NetBeans with interface
example codes of palindrome in NetBeans with interface
Write them yourself like the OP is trying to do here. You will learn better that way.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Dullme |
last post by:
i can hardly know what is the code for this. I have researched palindromes, but unfortunately, I only have read about integers not for characters..I need some help..
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| | |