+ 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 Respostas
+ 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