Monday, October 20, 2014

Print Stylish Asterisk In Java By increment operator

Program:

package prem6;

public class koresi6 {
public static void main(String[]args){
for(int i=1;i<=5;i++){
for(int j=1;j<=i;j++){
System.out.print("*");
}
System.out.println("");
}
}
}
Increment operator:   i++ and j++

Output:

*
**
***
****
*****

Screenshots

Program




Output



No comments: