Given the sequence of numbers: [1,2,3,4,5,6,7,8,9,10], design a program that will square each number in the sequence and return the sum of all the squares added together.
i need help to do this in java any idea with outputs and comments
i currently have a half working solution
import java.util.Scanner;
public class interview2 {
public static void main(String [] args)
{
Scanner sc = new Scanner(System.in);
System.out.print("Please enter a number: ");
int num = sc.nextInt();
System.out.println("Your squared number is: " + square(num));
}
public static int square(int num)
{
return num * num;
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…