AF
HomeTagSubmit NotesAsk AnythingLoginSubscribe Us
AF
1. Feel Free to ask and submit anything on Anyforum.in and get satisfactory answer
2. Registration is not compulsory, you can directly login via google or facebook
3. Our Experts are looking for yours ?.



corejava-programming: Java Program to print this output using For loop

Do a program in java to print this output
A
A A
AAAA
A A

corejava x 336
programming x 153
Posted On : 2016-10-15 20:13:21.0
profile ‫آية رافت‬‎ - anyforum.in ‫آية رافت‬‎
300
up-rate
3
down-rate

Answers


public class PatternLoop {
public static void main(String[] args) {
int stop=0;
for(int i=1;i<=4;i++){
if(i==4){
stop=2;
}else{
stop=(i-1)*(i-1)+1;
}
for(int j=0;j<stop;j++){
System.out.print("A");
}
System.out.println("");
}
}
}

Posted On : 2016-10-17 16:18:37
Satisfied : 1 Yes  0 No
profile Rishi Kumar - anyforum.in Rishi Kumar
523185319357
Reply This Thread
up-rate
3
down-rate



Post Answer
Please Login First to Post Answer: Login login with facebook - anyforum.in