0
Write a program to accept 20 different numbers in a SDA.Display the sum of all the numbers which are divisible by either 3 or 5
Can anyone tell me what's the issue in this I have made it....... SDA means Single Dimensional Array https://code.sololearn.com/c0segDc8y745/?ref=app
9 Respostas
+ 3
Remove a semicolon after loop in line 14
+ 1
It just works fine as you expect.
You need to provide all 20 inputs that separated in a new line for scanner object to work.
1
2
3
...
20
+ 1
Jayakrishna🇮🇳 thanks a lot bro
0
Jayakrishna🇮🇳 still it's not coming see
https://code.sololearn.com/c0segDc8y745/?ref=app
0
What's wrong with it? Do you want to print single time sum? Then write output statement out of loop..
What problem you are getting!?
0
Jayakrishna🇮🇳 it is saying exception in main thread I am not getting it 😔😔
0
Simba it's still not coming just enter the elements sentence is coming can you please modify the program for me please 🥺
0
Nandini Bhardwaj Enter values like
1 2 3 ..... 20 [hit enter]
You get output :
Enter element : (20 times)
...
Sum = <sum> (20 times)
Code is fine. Sololearn ask user to input only once so give all required inputs on popup by separated new line or (space separated except for nextLine() input. )
For interactive response, use system for same program. for testing purpose, use only less items like 5 only....
Hope it clears...
0
You're welcome..