+ 2
JAVA program to print the series n*(n-1),........6,2,0
Please help me in this series n*(n-1),........6,2,0 n is the number entered by the user. Thanks in advance!
3 odpowiedzi
+ 6
You could elaborate on your question pls?
Looks like you want to write a recursive method, like
3*2
2*1
1*0
Am I on the right way?
+ 2
Kinda Yes
Let me explain it
Let's take a sample input as 10
n*(n-1)=10*(10-1)=90
Now the value of n will be taken as 9
9*(9-1)=72
8*(8-1)=56
7*(7-1)=42
6*(6-1)=30
5*(5-1)=20
4*(4-1)=12
3*(3-1)=6
2*(2-1)=1
1*(1-1)=0
+ 2
Just did the code, check it out:
https://code.sololearn.com/cyvgtRiB7yyd/#java