Commit fa6fa7c8 by Patryk Czarnik

powtórz napis

parent f97e33ea
package p05_petle.zadania;
import java.util.Scanner;
public class PowtorzNapis {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Wprowadź linię tekstu:");
String tekst = scanner.nextLine();
System.out.print("Ile razy powtórzyć ten tekst? ");
int ileRazy = scanner.nextInt();
// Wypisz na ekran podany tekst tyle razy, ile chciał użytkownik
for(int i = 1; i <= ileRazy; i++) {
// System.out.println(tekst);
System.out.println(i + ": " + tekst);
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment