Skip to content

Latest commit

 

History

History
54 lines (41 loc) · 1.51 KB

prob2.md

File metadata and controls

54 lines (41 loc) · 1.51 KB

Problem

By Fandika Ikhsan


Problem Set: Intro to iteration and conditional logics

As a beginner programmer, it's important to practice computational thinking in order to improve your problem-solving skills. One way to do this is by working through programming problems that challenge you to think creatively and logically. In this problem set, we'll explore types of problems that will help you practice your computational thinking skills: stars and ladder

Sets:

  1. Box Stars

Write a Java program that takes an integer n as input and prints n rows of stars. Each row should have n stars takes from variable called userNum. For example, if userNum = 4, the program should output:

****
****
****
****
  1. Basic Ladder

Write a Java program that takes an integer n as input and prints a ladder of stars with n steps. Value of n takes from variable called ladderHeight. Each step should have one more star than the previous step. For example, if n = 4, the program should output:

*
**
***
****
  1. Diamond stars

Write a Java program that takes an odd integer n as input and prints a diamond shape made of stars. Value of n takes from variable called diamondKarat The diamond should have n rows and n columns in total. For example, if n = 5, the program should output:

  *
 ***
*****
 ***
  *

Note:

  • Please write your answer in document file and export it to PDF file.
  • Due in Thursday at 15.00 WIB.
  • Sent your answer to Whatsapp group.
  • Goodluck all!