Guest User

Untitled

a guest
Apr 26th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. package hello;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Hello
  6. {
  7. public static void main(String[] args)
  8. {
  9. Scanner scan = new Scanner (System.in);
  10. double n;
  11. double x;
  12. int y = 1;
  13. double z;
  14. double h;
  15. n = scan.nextDouble ();
  16. System.out.println ();
  17.  
  18. while (y <= n)
  19. {
  20. z = Math.pow (y, 2);
  21. y = y + 1 ;
  22. System.out.println (z);
  23. x = z;
  24. z = x + z;
  25. }
  26. System.out.println (z);
  27.  
  28. }
  29. }
Add Comment
Please, Sign In to add comment