Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package hello;
- import java.util.Scanner;
- public class Hello
- {
- public static void main(String[] args)
- {
- Scanner scan = new Scanner (System.in);
- double n;
- double x;
- int y = 1;
- double z;
- double h;
- n = scan.nextDouble ();
- System.out.println ();
- while (y <= n)
- {
- z = Math.pow (y, 2);
- y = y + 1 ;
- System.out.println (z);
- x = z;
- z = x + z;
- }
- System.out.println (z);
- }
- }
Add Comment
Please, Sign In to add comment