Write a Java program by using two for loops to produce the output shown below:
*******
******
*****
****
***
**
*
2 Answers
Start your code here
public class Twofor {
public static void main(String[] args) {
// TODO Auto-generated method stub
int i,j;
char n;
String ch = "programe";
for(i=0;i<ch.length();i++){
for(j=0;j<=i;j++){
n=ch.charAt(j);
System.out.print(n);
}
System.out.println();
}
}
}
public class Structure {
@BeforeClass
public static void setUpBeforeClass() throws Exception {
}
@AfterClass
public static void tearDownAfterClass() throws Exception {
}
@Before
public void setUp() throws Exception {
}
@After
public void tearDown() throws Exception {
}
@Test
public void test() {
}
@Test
public void Structure() {
int number=7;
for(int i = 1; i = i; j–) {
System.out.print(“*”);
}
System.out.println();
}
}
}