Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Molly Brown   on Aug 26 In Java Category.

  
Question Answered By: Della Simpson   on Aug 26

import java.io.*;

public class TriangleString{
public static void main(String[] args){
try{
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
String s = br.readLine();
while (s.length() > 0){
System.out.println(s);
s = s.substring(0, s.length()-1);
}
}catch(IOException ioe){
System.err.println("IOException: " + ioe.getMessage());
}
}

}

Share: 

 

This Question has 1 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Write this text out as a triangle Or get search suggestion and latest updates.


Tagged: