Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

sum of all multiples of 3 and 5 below 100

c = list(range(1,100))

total = 0

for i in (c):
    if i % 3 == 0 or i % 5 == 0:
      total += i
print (total)
Comment

Sum of all the multiples of 3 or 5

const findSum = n => {
  let countArr = []
  
  for(let i = 0; i <= n; i++) if(i % 3 === 0 || i % 5 === 0) countArr.push(i) 
  return countArr.reduce((acc , curr) => acc + curr)
}
console.log(findSum(5))

// With love @kouqhar
Comment

sum of multiples of 5 from 1 to 100

total = 0

for i in range(1, 100):
    if i % 3 == 0:
        total = total + i
print(total)

total1 = 0
for i in range(1, 100):
    if i % 5 == 0:
        total1 = total1 + i
print(total1)
Comment

PREVIOUS NEXT
Code Example
Python :: python goose 
Python :: Multiple page PyQt QStackedWidget 
Python :: list all items in digital ocean spaces 
Python :: kill os system by pid python script 
Python :: b-spline quantile regression with statsmodels 
Python :: Third step creating python project 
Python :: how to add the number to email address in faker library in python? 
Python :: initials of name 
Python :: seewave python 
Python :: how to deploy to shinyapps.io 
Python :: swap two elements in list python 
Python :: extract parameter of voice using python 
Python :: databases not showing in odoo 13 
Python :: expand array to a certain size python 
Python :: pip_install_packages2.bat 
Python :: menampilkan data dalam range tertentu di python 
Python :: why does async def not work python 
Python :: auto clipping path image using python 
Python :: &lt;function chr(i, /)&gt; error in python 
Python :: pade python 
Python :: python integrated with activeX 
Python :: python ocr pdf dataframe 
Python :: python add new line from textarea 
Python :: what should I do when the keras image datagenerato is nit working 
Python :: the process of delivery of any desisered data 
Python :: pandas isolate data lower than a certain percentage 
Python :: iterating over the two ranges simultaneously and saving it in database 
Python :: dynamo python template path 
Python :: Spansk dansk 
Python :: find-squares-and-odd-numbers-in-the-given-list 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =