1024programmer Java Lanqiao Cup 2018 Provincial Competition-Isosceles Triangle (Java Implementation)

Lanqiao Cup 2018 Provincial Competition-Isosceles Triangle (Java Implementation)

This question requires you to output an isosceles triangle composed of numbers on the console.
The specific steps are:

  1. First use the natural numbers 1, 2, 3,… to create a long enough string
  2. Use this string to fill the three sides of the triangle . Starting from the top vertex, fill counterclockwise.
    For example, when the height of the triangle is 8:

15706716516472.png

Input, a positive integer n( 3<n<300), represents the height of the triangle
Output, an isosceles triangle filled with numbers.

In order to facilitate evaluation, we require that spaces be replaced with “.”.

Input
an integer

Output
an isosceles triangle

Code:

import java.util.Scanner;public class Main { static Scanner sc = new Scanner(System.in)

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/lanqiao-cup-2018-provincial-competition-isosceles-triangle-java-implementation/

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: 34331943@QQ.com

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索