Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- *File name: Triangle.java
- *
- *Programmer: Derek Townsend
- *ULID: djtown1
- *
- *Date: Oct 23, 2017
- *
- *Class: IT 168
- *Lecture Section: 004
- *Lecture Instructor:Dr Xing Fang
- *Lab Section: 005
- *Lab Instructor: Simran Kaur
- */
- package edu.ilstu;
- import java.util.Scanner;
- /*
- *<insert description>
- *
- * @author Derek
- *
- */
- public class Triangle
- {
- public static void main(String[] args)
- {
- String star="";
- Scanner keyboard = new Scanner(System.in);
- System.out.println("Enter the size of a triangle from 1 to 50");
- int size=keyboard.nextInt();
- for(int i = 0;i<size;i++) {
- star+="*";
- System.out.println(star);
- }
- for(int j = 0;j<size;j++) {
- star=star.substring(0, star.length()-1);
- System.out.println(star);
- }
- keyboard.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement