Computer Science, asked by madhushreemp, 3 months ago

def differenceofSum(n. m)

The function accepts two integers n, m as arguments 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.​

Answers

Answered by muglafaq
0

Answer:

the same time as well I'm not sure if you want to the same time

Explanation:

type to get to the new one of the year and the other day

Answered by tanishathorat50
4

Explanation:

#includ<stdio.h>;

int differenceofSum(int n, int m)

{

int i, sum1 = 0, sum2 = 0;

for(i=1; i<=m; i++)

{

if(i%n==0)

{

sum1 = sum1 + i;

}

else

{

sum2 = sum2 + i;

}

}

return sum2 - sum1;

}

int main()

{

int n, m;

int result;

scanf("%d",&n);

scanf("%d",&m);

result = differenceofSum(n, m);

printf("%d",result);

return 0;

}

Input:

3

10

Output:

19

Similar questions