Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.FileNotFoundException;
- import java.util.Scanner;
- import java.io.File;
- import java.io.IOException;
- public class Homework08 {
- public static void main (String [] args) throws FileNotFoundException {
- Scanner scan = new Scanner(System.in);
- Scanner scanFileName= new Scanner(System.in);
- System.out.print("Enter a file name to read: ");
- String fileName = scanFileName.next();
- File f = new File(fileName);
- Scanner scanFile = new Scanner(f);
- System.out.print("Enter number of layer of stars: ");
- int n = scan.nextInt();
- for(int i=1; i <= n; i++) {
- //display stars
- for(int j=1; j <= (n+1-i); j++) {
- System.out.print("*");
- }
- System.out.println();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement