are the codes correct? because im having some errors in getting the output. tnx
create a program that will generate the following display:
use method declaration without return and with argument list. Input
value for the height of triangle.
5
54
543
5432
54321
5432
54
5
import java.io.*;
public class Meth2{
public static BufferedReader x = new BufferedReader(new InputStreamReader(System.in));
void method1() throws IOException{
int num, height;
System.out.pr int("Input height of triangle: ");
height = new Integer(x.readLine()).intValue();
for( int x=1; x<=9; x++ ) {
for( int y=1; y<=x; y++ ) {
System.out.print( "*" );
}
System.out.println( "" );
}
}
}
import java.io.*;
public class MethRun{
public static void main(String args[]) throws IOException{
Meth2 o = new Meth2();
o.method1();
}
}