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 | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
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

8th Apr 2022, 6:45 AM
Nandini Bhardwaj
Nandini Bhardwaj - avatar
9 Respuestas
+ 3
Remove a semicolon after loop in line 14
8th Apr 2022, 6:53 AM
Jayakrishna 🇮🇳
+ 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
8th Apr 2022, 7:46 AM
Simba
Simba - avatar
+ 1
Jayakrishna🇮🇳 thanks a lot bro
8th Apr 2022, 9:28 AM
Nandini Bhardwaj
Nandini Bhardwaj - avatar
8th Apr 2022, 7:04 AM
Nandini Bhardwaj
Nandini Bhardwaj - avatar
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!?
8th Apr 2022, 7:18 AM
Jayakrishna 🇮🇳
0
Jayakrishna🇮🇳 it is saying exception in main thread I am not getting it 😔😔
8th Apr 2022, 7:28 AM
Nandini Bhardwaj
Nandini Bhardwaj - avatar
0
Simba it's still not coming just enter the elements sentence is coming can you please modify the program for me please 🥺
8th Apr 2022, 8:00 AM
Nandini Bhardwaj
Nandini Bhardwaj - avatar
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...
8th Apr 2022, 8:40 AM
Jayakrishna 🇮🇳
0
You're welcome..
8th Apr 2022, 11:56 AM
Jayakrishna 🇮🇳