finds and displays the sum of multiples of 5 from 5 to n i.e. | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

finds and displays the sum of multiples of 5 from 5 to n i.e.

using while loop, write a program that reads from the user the value of an integer number n (has to be positive and multiple of 5). Then your program finds and displays the sum of multiples of 5 from 5 to n i.e. sum=5+10+15+20+ +n If the user enters wrong input, your program displays "Wrong input" message. THIS IS MY TRY https://www.sololearn.com/compiler-playground/cWy3Tx3XVWH3

11th Oct 2022, 10:49 PM
STOP
STOP - avatar
8 Respostas
0
# STOP , Try it intNum = int( input("Enter n ( >0 and muliple of 5 ): ") ) if intNum%5 != 0 or intNum <= 0: print("Wrong input") else: s=0 while intNum>=5: print(intNum) s += intNum intNum -= 5 print("The Sum : ", s) https://www.sololearn.com/compiler-playground/cdrXe2veP4QK
11th Oct 2022, 11:07 PM
SoloProg
SoloProg - avatar
+ 1
SoloProg can you write it as full code?
11th Oct 2022, 11:24 PM
STOP
STOP - avatar
0
What is the meaning of ā€œ\nā€ ? And can you write code without it? SoloProg
11th Oct 2022, 11:45 PM
STOP
STOP - avatar
0
new line :) Yes STOP you can
11th Oct 2022, 11:46 PM
SoloProg
SoloProg - avatar
0
When i delet ā€œ\nā€ it gives me error why SoloProg
11th Oct 2022, 11:53 PM
STOP
STOP - avatar
0
STOP , no way ā—‘ļ¹ā— chk again
11th Oct 2022, 11:58 PM
SoloProg
SoloProg - avatar
0
SoloProg lool its workšŸ˜‚ can you chat me DM?
12th Oct 2022, 12:08 AM
STOP
STOP - avatar