Computer Science, asked by Manjot2480, 1 year ago

Explain me the execution of this loop in Java:1 2 3 4 5 1 2 3 4 1 2 3 1 2 1

Answers

Answered by siddhartharao77
2
public class Example

 {    
 
 public static void main(String[] args) 

{      

  int a = 5;          

for(int i=a; i>=1;--i) 

{          

  for(int j=1; j<=i;++j)

 {          
 
      System.out.print(j+" ");    
 
        }        
 
    System.out.println(); 

       }  

  }

}
Answered by Incredible29
0
Heya user
Here is your answer !!

_____________

public class Series
{
public static void main ( String args [] )
{
int n , a ;
for ( n = 5 ; n >= 1 ; n-- )
{
for ( a = 1 ; a <= n ; a++ )
System.out.println ( a ) ;
}
}

______________

Hope it helps !!
Similar questions