ᴡʀɪᴛᴇ ᴀ ᴘʀᴏɢʀᴀᴍ ᴛᴏ ɢᴇɴᴇʀᴀᴛᴇ ᴀɴ ɪɴᴠᴇʀᴛᴇᴅ ᴛʀɪᴀɴɢʟᴇ ᴛɪʟʟ ɴ ᴛᴇʀᴍs. ᴘᴀss ᴠᴀʟᴜᴇ ᴏғ ɴ ᴀs ᴘᴀʀᴀᴍᴇᴛᴇʀ.
_________
Attachments:
Answers
Answered by
596
★ Pattern :
6 6 6 6 6
5 5 5 5 5
4 4 4 4
3 3 3
2 2
1
_________________________
Ans :
import java. util. *;
public class GenerateTriangle
{
public static void InvTriangle(int n)
{
for (int i = n ; i > = 1 ; i-- )
{ for (int j = 1 ; j < = i ; j++)
System.out.print(" " + i) ;
System.out.println( ) ;
}
}
}
──────⊱◈◈◈⊰──────
Answered by
2
★ Pattern : 6 6 6 6 6 5 5 5 5 5 4 4 4 4 3 3 3 2 2 1 _________________________Ans : import java. util. *; public class GenerateTriangle
Similar questions