diff --git a/2.py b/2.py new file mode 100644 index 0000000..247448c --- /dev/null +++ b/2.py @@ -0,0 +1,12 @@ +def divisible(num,div): + if(num%div==0): + return 1 + else: + return 0 + +sum=0; +for i in range(1,500): + if divisible(i,5) and not divisible(i,7): + sum+=i + +print("sum of numbers less than 500 which are divisible by 5 and not divisible by 7 is: {}".format(sum)) diff --git a/sum.py b/sum.py new file mode 100644 index 0000000..247448c --- /dev/null +++ b/sum.py @@ -0,0 +1,12 @@ +def divisible(num,div): + if(num%div==0): + return 1 + else: + return 0 + +sum=0; +for i in range(1,500): + if divisible(i,5) and not divisible(i,7): + sum+=i + +print("sum of numbers less than 500 which are divisible by 5 and not divisible by 7 is: {}".format(sum))