6. Write a program to print out a triangle using nested loop. ( * *** ***** ******* ********* ******* ***** *** *
Added by Dalton M.
Close
Step 1
The pattern of the triangle is such that it first increases in width, reaches a maximum width, and then decreases. The pattern provided suggests a pyramid that expands and then contracts. The sequence of stars (*) in each line increases and then decreases in a Show more…
Show all steps
Your feedback will help us improve your experience
Jennifer Stoner and 69 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Complete the program below to print out a filled triangle four lines high. In other words, the output of this program should match the following, exactly: X XXX XXXXX XXXXXXX Triangle.java A program to draw a filled triangle public class Triangle { public static void main(String[] args) { System.out.println("x"); /* Your work here */ } }
Willis J.
Write a program to print a diamond made up of left- and right-aligned right-angled isosceles triangles, all of positive integer height specified by the user's keyboard input (a positive integer), as follows: Enter triangle height: 6 ************ ***** ***** **** **** *** *** ** ** * * ** ** *** *** **** **** ***** ***** ************
William M.
C# Assignment 6: Triangle Write an application that can be used to determine if three line segments can form a triangle. Prompt the user for the length of three line segments as integers. If non-numeric characters are entered, re-prompt the user for new values. If the three lines could form a triangle, print the integers and a message indicating that they form a triangle. Use a state-controlled loop to allow users to enter as many different combinations as they want.
Supreeta N.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD