0
Create a NameBackwards application that prompts the user for his or her name and then displays the name backwards.
I need the code. I'm new to this! My code needs an array in it too!
12 Respostas
+ 14
Can you show us some sample input and output? Not fully understanding your question and code
+ 14
String output = "";
for (int letter = wordLetters.length - 1; letter >= 0; letter++) {
output += wordLetters[letter];
}
//print output
This should reverse a string... Not sure what your code does exactly
+ 13
Can you show us what you've got already? And I'm assuming it's in Java?
+ 12
So good to see you again @LEANDRO MACIEL...
+ 7
usr = input()
print(usr[::-1])
Done đ
+ 5
@MrCoder I like how you use Python already đ
+ 2
pretty simple for js :D
But...I will not post anythin' untill I'll see what you did or at least you're tryed somethin'.
+ 2
So, did I do this right @rose:
import java.util.Scanner;
public class NameBackwards {
public static void main(String[] args) {
final int LOW = 'A'; //smallest possible value
final int HIGH = 'Z'; //highest possible value
int[] letterCounts = new int[HIGH - LOW + 1];
Scanner input = new Scanner(System.in);
String word;
char[] wordLetters;
int offset; //array index
/* prompt user for a word */
System.out.print("Enter a word: ");
word = input.nextLine();
/* convert word to char array and count letter occurrences */
word = word.toUpperCase();
wordLetters = word.toCharArray();
for (int letter = 0; letter < wordLetters.length; letter++) {
offset = wordLetters[letter] - LOW;
letterCounts[offset] += 1;
}
for (int i = LOW; i <= HIGH; i++) {
System.out.println((char)i + ": " + letterCounts[i - LOW]);
}
}
}
+ 2
import java.io.*;
import java.util.*;
public class reverseString {
public static void main(String[] args) {
String input=""; System.out.println("Enter the input string");
try { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
input = br.readLine();
char[] try1= input.toCharArray();
for (int i=try1.length-1;i>=0;i--) System.out.print(try1[i]);
}
catch (IOException e) { e.printStackTrace();
}
}}
0
Someone to help me with a C # language solution
0
And ok can you help me with a C # language solutions please
0
Jafca can you help me please