Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners How to print the following pattern in java?
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


praful
How to print the following pattern in java?
1 Answer(s)      2 years and 9 months ago
Posted in : Java Beginners


How to print the following pattern in java?

he he is he is going he is going in


Advertisement
View Answers

March 29, 2012 at 4:45 PM


import java.io.*; 
class StringPattern 
{ 
    public static void main(String[] args) throws IOException{ 

        String st="he is going in";
        String str[]=st.split(" ");

        for(byte i=0;i<str.length;i++) 
        { 
            System.out.println(); 

            for(byte j=0;j<=i;j++) 
                System.out.print(str[j]+" "); 
        } 
    }
}


Related Tutorials/Questions & Answers:
Advertisements
Advertisements
 

 

 

DMCA.com