- 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.

10th Apr 2018, 4:02 PM
Ratnapal Shende
Ratnapal Shende - avatar
10 Antworten
+ 1
https://code.sololearn.com/c5zsreJW2s6p/?ref=app In python, also the range can be changed easily
10th Apr 2018, 4:16 PM
TurtleShell
TurtleShell - avatar
+ 5
Please like my question..
10th Apr 2018, 4:09 PM
Ratnapal Shende
Ratnapal Shende - avatar
+ 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)
10th Apr 2018, 4:07 PM
syul
syul - avatar
+ 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); }
10th Apr 2018, 4:12 PM
syul
syul - avatar
10th Apr 2018, 4:40 PM
Calviղ
Calviղ - avatar
+ 1
python oneliner print(*[i for i in range(2000, 3201) if not(i%7) and i%5])
10th Apr 2018, 5:25 PM
Louis
Louis - avatar
+ 1
c++ with lot of around. Function is 1 line code https://github.com/alepir/Cplusplus/blob/master/chall.cpp
11th Apr 2018, 9:18 PM
Pavel Šesták
Pavel Šesták - avatar
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.
10th Apr 2018, 4:12 PM
Alpha Rays
Alpha Rays - avatar
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
7th Feb 2020, 3:27 PM
G.s.praveen naveen
G.s.praveen naveen - avatar
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))
7th Aug 2020, 2:32 AM
Bhavendra Soni
Bhavendra Soni - avatar