Advertisement
Guest User

Untitled

a guest
Jan 18th, 2020
432
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 { // MIHIN JA MITEN SE WHILE TULEE???
  3. public static void main(String[] args) {
  4. int n;
  5. int kertoma;
  6. int alku = 1;
  7.  
  8.  
  9. BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
  10.  
  11. try {
  12. System.out.print("Anna kokonaisluku:");
  13. n = Integer.parseInt(in.readLine());
  14. kertoma = alku * alku++;
  15. System.out.println("Luvun " + n + " kertoma on " + kertoma);
  16.  
  17. } catch(Exception e) {
  18. System.out.println("Virhe syötteessä.");
  19. }
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement