Answer to Question #29023 in Java | JSP | JSF for Zus ming

Question #29023
I have been Asked to a java program that display the following output using the conditional control statement :.

.The Output :.

@
@ @
@ @ @
@ @ @ @
@ @ @ @ @
@ @ @ @ @ @
@ @ @ @ @
@ @ @ @
@ @ @
@ @
@

Thats All .
1
Expert's answer
2013-04-26T11:22:03-0400

//class Pattern
public class Pattern {

//main function
public static void main(String[] args) {
String str="";//declare variable str
for(int i=0;i<6;i++){
//show result
str+="@";
System.out.println(str);
}
String newstr="";//declare new variable newstr for bottom
for(int i=5;i>0;i--){
newstr="";
for(int j=0;j<i;j++){
newstr+=str.charAt(j);
}
System.out.println(newstr);//show bottom

}
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS