×
FREE ASSISTANCE FOR THE INQUISITIVE PEOPLE
Tutorial Topics
X
softetechnologies
What are classes and objects in java.
Write a programme to print the following pattern - Java
2257    Arnab De    16/06/2018

Write a programme to print the following pattern

N P S
  N P S
    N P S
      N P S
        N P S
          N P S

 

 

 

 

softetechnologies
public class Pat2
{
    public static void main(String []args)
    {
        int r,c,n=6;
        for(r=1;r<=n;r++)
        {
            for(c=1;c<r;c++)
            {
                System.out.print(" ");
            }
            System.out.println("N P S");
        }
    }
}

softetechnologies

Output
N P S
  N P S
    N P S
      N P S
        N P S
          N P S
What are classes and objects in java.
softetechnologies
Author Details
Arnab De
I have over 16 years of experience working as an IT professional, ranging from teaching at my own institute to being a computer faculty at different leading institute across Kolkata. I also work as a web developer and designer, having worked for renowned companies and brand. Through tutorialathome, I wish to share my years of knowledge with the readers.
Enter New Comment
Comment History
No Comment Found Yet.
Nelson Mandela
Education is the most powerful weapon which you can use to change the world.
Nelson Mandela
2830
38.7
Today So Far
Total View (Lakh)
softetechnologies
01/01/2018     34306
28/06/2017     30940
26/05/2018     30853
02/08/2017     28850
25/06/2018     26167
15/05/2017     24598
01/08/2017     23447
06/07/2017     23179
21/04/2018     19206
14/07/2017     18464
softetechnologies