Write a Java program named Spikey that produces the followin

Write a Java program named Spikey that produces the following output

\\ /

\\ \\ / /

\\ \\ \\ / / /

/ / / \\ \\ \\

/ / \\ \\

/ \\

Solution

package chegg;

public class Spikey
{
   /* main funcation*/
   public static void main(String[] args)
   {
       /*initialize integer variable i,j,k*/
   int i, j, k;
      
   for(i=1;i<=3;i++)
   {
       for(j=1;j<=i;j++)
       {
       System.out.print(\"\\\\\");/*--- print backslash--- */
       }
       for(k=1;k<=i;k++)
       {
       System.out.print(\"/\");/*--- print forward slash --- */
       }
       System.out.println();/* new line */
       }
  
   for(i=3;i>=1;i--)
   {
       for(j=1;j<=i;j++)
       {
       System.out.print(\"/\");/*--- print forward slash --- */
       }
       for(k=1;k<=i;k++)
       {
       System.out.print(\"\\\\\");/*--- print backslash--- */
       }
       System.out.println();/* new line */
   }
  
         
   }
      
}// end of class Spikey

================================================

output :-

\\/
\\\\//
\\\\\\///
///\\\\\\
//\\\\
/\\

---------------------------------------------------------------------------------------------

If you have any query, please feel free to ask

Thanks a lot

Write a Java program named Spikey that produces the following output \\ / \\ \\ / / \\ \\ \\ / / / / / / \\ \\ \\ / / \\ \\ / \\Solutionpackage chegg; public cl
Write a Java program named Spikey that produces the following output \\ / \\ \\ / / \\ \\ \\ / / / / / / \\ \\ \\ / / \\ \\ / \\Solutionpackage chegg; public cl

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site