Menu

Please Solve Java Assume Already Defined Variable Type Int Called Num Following Line Code Q43886712

Please solve this in Java.

Assume we have already defined a variable of typeint called num with the followingline of code:

int num = ???; // ‘num’ can have any int value

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

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

—–*———***——-*****—–*—–*—***—***-*****-*****

Sample Input:

5

Sample Output:

—–*———***——-*****—–*—–*—***—***-*****-*****

Expert Answer


Answer to Please solve this in Java. Assume we have already defined a variable of type int called num with the following line of c…

OR