मराठी

Write Two Separate Programs to Generate the Following Patterns Using Iteration (Loop) Statement: - Computer Applications

Advertisements
Advertisements

प्रश्न

Write two separate programs to generate the following patterns using iteration (loop) statement:

(a)

टीपा लिहा

उत्तर

public class pattern1
{
public static void main( )
{
   for (int i=1; i<=5; i++)
   {
      for(int j=1; j<=i; j++)
      {
         if(j %2==1)
        System.out.print("*");
        else
        System.out.print("#");
     } 
    System.out.println( );
  }
}
}  

shaalaa.com
Introduction of Iterative Constructs in Java
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
2014-2015 (March) Set 1
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×
Our website is made possible by ad-free subscriptions or displaying online advertisements to our visitors.
If you don't like ads you can support us by buying an ad-free subscription or please consider supporting us by disabling your ad blocker. Thank you.