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 :: concatenate data vertically python 
Python :: reverse geocoding python 
Python :: python datetime format 
Python :: django urlpattern 
Python :: download images python google 
Python :: sample data frame in python 
Python :: how to make a class in python 
Python :: numpy empty image 
Python :: capitalise words in a column pandas 
Python :: python sizeof 
Python :: is power of python recursion 
Python :: python pyramid 
Python :: convert excel file to csv with pandas 
Python :: import sklearn.metrics from plot_confusion_matrix 
Python :: api in python 
Python :: how to make a minute counter in python 
Python :: mutable and immutable in python 
Python :: playsound error python 
Python :: how to get an input into a list python 
Python :: how to print a matrix in python 
Python :: df reset index 
Python :: pyttsx3 set volume 
Python :: python version 
Python :: transpose array python 
Python :: how to remove rows with certain values pandas 
Python :: python list to string 
Python :: pandas duplicated rows count 
Python :: how to drop a column in python 
Python :: __call__ python 
Python :: regex findall 
ADD CONTENT
Topic
Content
Source link
Name
3+9 =