Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class DibuixaTriangle {
- public static void main (String[] args) {
- Scanner lector = new Scanner(System.in);
- System.out.print("Quina alçada vols? ");
- int alt = lector.nextInt();
- lector.nextLine();
- int numAs = 1;
- //Una iteració per línia.
- for(int i = 0; i < alt; i++) {
- //Escribim un cert nombre de lletres 'a'.
- for(int j = 0; j < numAs; j++) {
- System.out.print("a");
- }
- numAs++;
- System.out.println();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement