Write a Java program using nested for loops.?

We need to generate a Espresso program which produces this output.

1)
!!!!!!!!!!!!!!
\\!!!!!!!!!! //
\\\\!!!!!! ////
\\\\\\!! //////

2)
!!!!!!!!!!!!!!!!!!!!!!
\\!!!!!!!!!!!!!!!!!! //
\\\\!!!!!!!!!!!!!! ////
\\\\\\!!!!!!!!!! //////
\\\\\\\\!!!!!! ////////
\\\\\\\\\\!! //////////

Example 1) carries a height of 4 and also Example 2) includes a height regarding 6.
This software must ask the person to enter the elevation and output an idea like above depending on the height entered (from height 4 in order to height A FEW the peak and thickness changed).
(The examples should look for instance triangles, sorry)

Have to be done along with nested loops.And a strong output might only end product 1 character at the same time.

Thanks ahead of time.:)

Here will be my computer code using just nested loops.Operates perfect regarding me

tranfer java.io.BufferedReader;
tranfer java.io.IOException;
tranfer java.io.InputStreamReader;
arrest class Primary

arrest static avoid main(String args)throws IOException
Procedure.out.println(“Enter levels:”);
BufferedReader inside = innovative BufferedReader(new InputStreamReader(System.in));
Stringed input=in.readLine();
int n=Integer.parseInt(input);
int sum=2;
for(int i=0; i<n-1; i++)
sum=sum+4;

Stringed s=new String nsum;
for(int i=0; i<n; i++)
for(int j=0; j<sum; j++)
sij=”! “;

int r=0;
for(int i=0; i<n; i++)
r=r+2;
for(int j=0; j<sum; j++)
for(int t=0; t<r && i<n-1; t++)
si+1t=”\\”;

int p=sum;
for(int i=0; i<n; i++)
p=p-2;
for(int j=0; j<sum; j++)
for(int t=sum-1; t>p-1 && i<n-1; t–)
si+1t=”/”;

for(int i=0; i<n; i++)
for(int j=0; j<sum; j++)
Procedure.out.print(“” + sij);

Procedure.out.println(“”);

Tested for peak 1, ONLY TWO, 3, SEVERAL, 5, 6, 10…

levels 1

!!

levels 2

!!!!!!
\\!! //

levels 3

!!!!!!!!!!
\\!!!!!! //
\\\\!! ////

levels 4

!!!!!!!!!!!!!!
\\!!!!!!!!!! //
\\\\!!!!!! ////
\\\\\\!! //////

levels 5

!!!!!!!!!!!!!!!!!!
\\!!!!!!!!!!!!!! //
\\\\!!!!!!!!!! ////
\\\\\\!!!!!! //////
\\\\\\\\!! ////////

levels 6

!!!!!!!!!!!!!!!!!!!!!!
\\!!!!!!!!!!!!!!!!!! //
\\\\!!!!!!!!!!!!!! ////
\\\\\\!!!!!!!!!! //////
\\\\\\\\!!!!!! ////////
\\\\\\\\\\!! //////////

levels 10

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
\\!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //
\\\\!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ////
\\\\\\!!!!!!!!!!!!!!!!!!!!!!!!!! //////
\\\\\\\\!!!!!!!!!!!!!!!!!!!!!! ////////
\\\\\\\\\\!!!!!!!!!!!!!!!!!! //////////
\\\\\\\\\\\\!!!!!!!!!!!!!! ////////////
\\\\\\\\\\\\\\!!!!!!!!!! //////////////
\\\\\\\\\\\\\\\\!!!!!! ////////////////
\\\\\\\\\\\\\\\\\\!! //////////////////
If you don’t understand, i want to know.Hope this can help you!

Have you tried achieving this yet It seems like you just posted the homework assignment so are hoping for a hassle-free answer.Issues given that a try it is best to post the actual code.

Notice the pattern.You start switching! intended for / or even \.When you need help when using the details with the implementation you possibly can contact my family at my website.I can help you.

http://clearsidetechnologies.com/.

Leave a Reply