boold
Question of apatten
1 Answer(s)      a year and a month ago
Posted in : Java Interview Questions

Welcome EveryOne , I have the progrem of apatten But have Errors within the program :

public class pattern {
public static void main(String[]args){
displaypattern(7);
}
public static void displaypattern(int n){
for(int rows=1;row <=n;row++){
//print space
for(int i=row;i<n;i++)
System.out.print(" ");
//print numbers
for(int i=row;i>=1;i--)
System.out.print(" "+i);
System.out.println();

}
}
}

So Do you know what are the mistakes ?

View Answers

April 24, 2012 at 3:32 PM


We have modified your code.

  public class pattern {
    public static void main(String[]args){
    displaypattern(7);
    }
    public static void displaypattern(int n){
    for(int row=1;row <=n;row++){
    //print space
    for(int i=row;i<n;i++)
    System.out.print(" ");
    //print numbers
    for(int i=row;i>=1;i--)
    System.out.print(" "+i);
    System.out.println();

    }
    }
    }









Related Pages:
Question of apatten
Question of apatten  Welcome EveryOne , I have the progrem of apatten But have Errors within the program : public class pattern { public static void main(String[]args){ displaypattern(7); } public static void
question
question   sir plz tell me what should i give in title box. just i want java program for the question typed in this area
question
question   sir plz tell me what should i give in title box. just i want java program for the question typed in this area
Question
Question   When there is an exception in my program how java runtime system handles
question
question  dear sir/madam my question is how to compare two text format in java..we are java beginners..so we need the complete source code for above mentioned question...we have to compare each and every word
question
question  Dear sir i had some typing mistake at previous question so its my humble request to let me know the steps to start the tomcat6 under the tomcat directory
question
question  Gud morning sir, I have asked u some question regarding jsp in saturaday for that i didnot find any answere in which u send me the some of the links.U have asked me the specify some details. There is a entity name
Question?
Question?  My question is how to: Add a menu bar to the program with a File menu. In the File menu, add a submenu (JMenuItem) called About. When the user clicks on the About menu item, display a JOptionPane message dialog

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.