Do you think you can easily multiply ten consecutive numbers from 1 to 10 in your mind? If this seems easy to you, you've probably never tried it. Here's a hint: the product is not a small number; it's more than three million. But this is easy for a computer: the important thing is to tell it how to do it.
Product of 10 numbers
- 3
Locked
Comments (27)
- Popular
- New
- Old
You must be signed in to leave a comment
RUBEN CABRERAExpert
15 August 2021, 02:30
Could you give me a better explanation about this task I do not understand.
0
Cleber Machado Backend Developer
15 October 2021, 12:25
😅😅😅
1 * 2 .....9 * 10
0
hidden #10757948
18 June 2021, 09:59
Just multiply 1-10 inside System.out.println();
0
Java_Mooood
16 October 2020, 19:32
No loop is needed , just println
0
Tim Said
4 October 2020, 17:05
Did it with a for-loop. My result was correct however it said that the last two tasks,
- The displayed number should be more than three million.
- The displayed number must match the task conditions.
are not correct. Used a simple println method and then it worked. No idea why the loop didn't work although the result was the same
0
Roman
5 October 2020, 06:08
Give me your code with a for-loop in PM, I'll check it.
0
Ahmad Dabagh
18 September 2020, 12:10
I did it in the Hard Way but i did it finaly with 10 for loops inside each other
0
Constantin Anton
14 August 2020, 21:18
Simple, do not multiply 10 number at once but x = 1 * 2 * 3 ; y = x * 4 * 5 * 6 etc.
0
Roman
17 August 2020, 05:30
Why?)
+2
AlasCaras
16 February 2021, 05:09
correct!
0
Barsha
14 July 2020, 06:31
I am getting an output of 9864100. Incrementing i in the for loop: for(int i =0;i<=10;i++)
int z is the product z*=i and then incrementing z. Printing out the output (z) outside the for loop.
My code still fails the last task condition. Please help debug what I am doing wrong
0
Roman
14 July 2020, 07:03
Please post your question with the attached solution in the section Help.
1*2*3*...*10 = 3 628 800
+2
Edddieg
5 June 2020, 16:19
best to use factorial to solve this problem
+1
Nastya
2 May 2020, 15:04
I think recursion is a better way to solve the problem
+3
Deborah Wenrich
5 November 2019, 22:42
int z is my friend, i made it do all the work.
0