Given a non-negative integer n, write a program, name it Triangle that will return the number of blocks it takes to make

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Given a non-negative integer n, write a program, name it Triangle that will return the number of blocks it takes to make

Post by answerhappygod »

Given a non-negative integer n, write a program,
name it Triangle that will return the number of blocks it takes to
make a triangle with n.
Use the Scanner method to get user input for n
Ex.
n = 1 returns: 1 block is needed to make a triangle with 1
row.
n = 2 returns: 3 blocks are needed to make a triangle with 2
rows.
n = 3 returns: 6 blocks are needed to make a triangle with 3
rows. And so on.
Java
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply