package sara78;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.lang.IndexOutOfBoundsException;
public class node extends RuntimeException{
private static String string;
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
InputStreamReader input = new InputStreamReader(System.in);
BufferedReader reader = new BufferedReader(input);
try {
string = reader.readLine();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
char[] c=string.toCharArray();
int k=c.length;
for(int i=0;i<=k;i++)
{
System.out.println(""+c[i]);
}
for(int i=k;i<=k;--i)
{
System.out.println(""+c[i]);
}
}
}
As well, you could do it with a different approach, same idea:
import java.util.*;
public class Example
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
System.out.println("Please enter a String to reverse:");
String toReverse = in.next();
String Reversed = "";
for (int i = toReverse.length()-1; i>=0; i--)
{
Reversed = Reversed + toReverse.charAt(i);
}
System.out.println(Reversed);
}
}
public class ReverseStringTest {
public static void main(String[] args) {
String str = "What's going on?";
System.out.println(ReverseString.reverseIt(str));
}
}
class ReverseString {
public static String reverseIt(String source) {
int i, len = source.length();
StringBuffer dest = new StringBuffer(len);
for (i = (len - 1); i >= 0; i--)
dest.append(source.charAt(i));
return dest.toString();
}
}
import java.util.*;
public class Example
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
System.out.println("Please enter a string to reverse:");
String input = in.next();
String reversed = "";
for (int i = 0; i<input.length(); i++)
{
reversed = input.charAt(i) + reversed;
}
System.out.println("The reversed string is: " + reversed);
}
}
int[] iArrNumbers = new int[5];
for(int iLoop = 0; iLoop < 5; iLoop++)
iArrNumbers[iLoop] = (iLoop + 4) * (((iLoop + 1) * (iLoop + 1) * 4) + 4); // increasing but not adjacent
// So now the array is: 32, 100, 240, 476, 832
// Reverse in a simple (although perhaps not the most efficient manner)
List
Collections.reverse(lstNumbers);
for(int iLoop = 0, iLength = lstNumbers.size(); iLoop < iLength; iLoop++)
iArrNumbers[iLoop] = lstNumbers.get(iLoop);
// iArrNumbers is now: 832, 476, 240, 100, 32 (my math beside the point)
public static final String reverseString(final String str) {
return new StringBuilder(str).reverse().toString();
}
Collections.reverse(list);
The use of the reverse string in C program is used to reverse the letters in the string. An example would be reverse me would be reversed to em esrever.
You can create a separate string initially empty. Then using a loop, start at the end of the string and add it to the end of the other string. At the end of the loop, the other string would contain the reverse.
i dont no string for servlate
In order to program a reverse auto loan calculator in JAVA, you are going to need a lot of experience with JAVA. There are online tutorials that can help you set up with fundamentals of JAVA so that you will be able to create almost any basic program you want.
what is string
The use of the reverse string in C program is used to reverse the letters in the string. An example would be reverse me would be reversed to em esrever.
You can create a separate string initially empty. Then using a loop, start at the end of the string and add it to the end of the other string. At the end of the loop, the other string would contain the reverse.
The string trim works in Java by trimming white space from the beginning and end of a string. It cleans up the string and makes makes it neater for the users of the program.
i dont no string for servlate
In order to program a reverse auto loan calculator in JAVA, you are going to need a lot of experience with JAVA. There are online tutorials that can help you set up with fundamentals of JAVA so that you will be able to create almost any basic program you want.
what is string
.... String line = "This is example program with spaces"; String[] tokens = line.split(" "); System.out.println(tokens.length-1); .......
You can use the toUpperCase() method on a String to convert any String to all uppercase.
StringBuffer is java class available in java.lang package which provides mutable String object where String is immutable class. The methods of this class like reverse(), append(),insert() gives facility to insert data of the same object.
i am sam
public class HaveAGoodDay { public static void main(String[] args) { for (final String arg : args){ System.out.print(arg +" "); } } } compile and run the program: java HaveAGoodDay have a good day. output: have a good day.
In python, type the following into a document. NOTE: Sentences following a # symbol are comments, and are not necessary for the program to run. #!/usr/bin/python #This program takes a input from a user and reverses it. number = input("Type a number: ") #This takes input from a user. a = len(number) #This finds the length of the number reverse = "" #This sets the variable reverse to an empty string. for i in number: a = a-1 #The places in a string start from 0. The last value will be the length minus 1.reverse = reverse + number[a] #Makes the number's last digit the new string's first. print("The reverse of", number, "is", reverse + ".") #prints the resulting string. This program will take any sequence of characters and reverse them. The final value is a string, but if an integer is needed, one needs only to add the line reverse = int(reverse) above the print statement. However, this will stop the program from being able to reverse strings, as it is not possible to convert a string to an integer if it is not a number.