Write a for statement to compute the sum 1 + 22 + 32 + 42 + 52 + ... + n2.
What will be an ideal response?
```
sum = 0;
for( i=1; i<=n; i++){
sum += i*i;
}
System.out.println("The sum is " + sum);
```
This code is in Fragments.java.
Computer Science & Information Technology
You might also like to view...
From the following choices, select the bus or architecture with the greatest power and adaptability
A) DisplayBus B) PCIe C) ISA D) AGP
Computer Science & Information Technology
The defined standard for the structure of an email is ____________
a. AARPA b. MIME c. ICMP d. RFC 2100
Computer Science & Information Technology