- 4

# Write a program which will find all such numbers which are divisible by 7 but are not a multiple of 5, between 2000 and 3200

(both included). The numbers obtained should be printed in a comma-separated sequence on a single line.

10 Answers

+ 1

https://code.sololearn.com/c5zsreJW2s6p/?ref=app
In python, also the range can be changed easily

+ 5

Please like my question..

+ 3

I use c# but i assume logical operators are the same
int i
(Making a method)
Check(i)
if i%7==0&&i%5!=0
(If true statement is true)

+ 1

Some presets...
static void main(string[] args)
{
for(int n=2000;n<3200;n++)
{
Console.Write(check(n)?n+â,â:ââ);
}
}
static bool check(int i)
{
return (i%7==0)&&(i%5!=0);
}

+ 1

python oneliner
print(*[i for i in range(2000, 3201) if not(i%7) and i%5])

+ 1

c++ with lot of around. Function is 1 line code
https://github.com/alepir/Cplusplus/blob/master/chall.cpp

0

Logic is simple:
if(i%7==0 && i%5!=0)
within loop statement.
I am not a good programmer but from my experience I will recommend you to think about the problem and try to do by itself. Run programs , debug errors then only you can code.

0

1.Write a program which will find all such numbers which are divisible by n but are not a multiple of m, between L and H (both included).The numbers obtained should be printed in a comma

0

Try this one
number=[]
for x in range(2000, 3201):
if (x%7==0) and (x%5>0):
number.append(str(x))
print (','.join(number))