Advertisement
Guest User

Untitled

a guest
Jan 24th, 2020
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. import java.io.*;
  2. public class Kertoma {
  3. public static void main(String[] args) {
  4. int n;
  5. int kertoma = 1;
  6. int alku;
  7.  
  8.  
  9. BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
  10.  
  11. try {
  12.  
  13. System.out.print("Anna kokonaisluku:");
  14. n = Integer.parseInt(in.readLine());
  15.  
  16. for (alku = 1; alku <= n; alku++) {
  17.  
  18. kertoma = kertoma * n;
  19. System.out.println("Luvun " + n + " kertoma on " + kertoma);
  20. }
  21. } catch (Exception e) {
  22. System.out.println("Syƶte on virheellinen.");
  23. }
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement