Get Writing Help
WhatsApp
    ✍ ️Get Free Writing Help
WhatsApp

Please solve this in Java. Assume we have already defined a variable of type int called…


Write My Assignment FREE

Homework Help Question & Answers

Please solve this in Java. Assume we have already defined a variable of type int called…

Please solve this in Java.

Assume we have already defined a variable of type int called num with the following line of code:

int num = ???; // 'num' can have any int value

TASK: Print a Triforce composed of 3 centered triangles created with num asterisks (*) on the bottom row, num – 2 asterisks on the next bottom row, …, and 1 asterisk on the top row, and such that the triangles are surrounded by hyphens (-). You can assume that num is odd and is at least 3.

EXAMPLE: If num is 5, the resulting Triforce would be the following:

-----*----- ----***---- ---*****--- --*-----*-- -***---***- *****-*****

Sample Input:

5

Sample Output:

-----*----- ----***---- ---*****--- --*-----*-- -***---***- *****-*****
0 0
Add a comment
Plagiarism Free Assignment Help

Expert Help With This Assignment — On Your Terms

Native UK, USA & Australia writers Deadline from 3 hours 100% Plagiarism-Free — Turnitin included Unlimited free revisions Free to submit — compare quotes
Write My Assignment FREE Get A Free Quote →
Limited Offer     Get 25% off your first order — use code STUDYLINK25 at checkout    Claim Now
 
Don`t copy text!