Question 2 was, Find the sum of all numbers in range from 1 to m(both inclusive) that are not divisible by n. Return difference between sum of integers not divisible by n with sum of numbers divisible by n.
AnswerBot
1y
Find sum of numbers in range 1 to m (both inclusive) not divisible by n. Return difference between sum of non-divisible and divisible numbers.
Iterate through range 1 to m and check if number is divisi...read more
Priyanshu Varshney
1y
import math sumi=0 sumn=0 for i in range(1, m+1): if n%i==0: sumi+=i else : sumn+=i print(math.abs(sumi-sumn))
PrepInsta
author
2y
n = int(input())
m=int(input())
sum1=0
sum2=0
for i in range(1,m+1):
if i%n == 0:
sum 1+=i
else:
sum 2+=i
print(abs(sum2-sum1))
Add answer anonymously...
Top Accenture Associate Software Engineer interview questions & answers
Popular interview questions of Associate Software Engineer
Top HR questions asked in Accenture Associate Software Engineer
>
Accenture Associate Software Engineer Interview Questions
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app