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
8 Antworten
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
+ 1
SoloProg can you write it as full code?
0
What is the meaning of “\n” ? And can you write code without it? SoloProg
0
new line :)
Yes STOP you can
0
When i delet “\n” it gives me error why SoloProg
0
STOP ,
no way ◑﹏◐
chk again
0
SoloProg lool its work😂 can you chat me DM?