Java program | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 1

Java program

Write a program to find the sum of the following series: (1∗ 1)+(2∗ 2)+(3∗ 3)+(4∗4)+...+(n∗ n) Output: User input: 6 1∗ 1=1 2∗ 2=4 3∗ 3=9 4∗ 4=16 5∗ 5=25 6∗ 6=36 The summation of the series: 91

20th Oct 2021, 5:45 PM
اميره القرني
4 Respuestas
+ 10
اميره القرني to get useful help from the community,  we need to see your attempt first. without having seen your code, it is difficult to find out where the issue is. => please put your code in playground and link it here thanks!
20th Oct 2021, 5:51 PM
Lothar
Lothar - avatar
+ 6
اميره القرني Hint - 1 - Use for loop and start iteration from 1 to userinput 2 - get square of each iteration value 3 - get sum of each square value.
20th Oct 2021, 5:54 PM
A͢J
A͢J - avatar
+ 1
class Series { public static void main(String args) { int n = Integer.parseInt(args[0]); int s=0; for(int i=1;i<=n;i++) { System.out.println(i + “ * “ + i + “ = “ + i*i); s+= (i*i); } System.out.println(“The summation of the series : “ + s); } }
22nd Oct 2021, 7:47 AM
sree harsha
sree harsha - avatar
0
اميره القرني if you want me to explain how to solve this in Arabic ; I am ready .
21st Oct 2021, 4:10 PM
**🇦🇪|🇦🇪**
**🇦🇪|🇦🇪** - avatar