Numbers that are divisible by 7 but are not a multiple of 5
Divisibility by 5 is effortlessly dictated by checking the last digit in the number (475), and checking whether it is either 0 or 5. In the event that the last number is either 0 or 5, the whole number is separable by 5
In the event that the last digit in the number is 0, the outcome will be the excess digits increased by 2. For instance, the number 40 finishes in a zero (0), so take the excess digits (4) and multiply that by two (4 × 2 = 8). The outcome is equivalent to the consequence of 40 divided by 5(40/5 = 8).
In the event that the last digit in the number is 5, the outcome will be the excess digits increased by two (2), in addition to one (1). For instance, the number 125 closures in a 5, so take the leftover digits (12), multiply them by two (12 × 2 = 24), then, at that point add one (24 + 1 = 25). The outcome is equivalent to the aftereffect of 125 divided by 5 (125/5=25).
Example:
If the last digit is 0
110 (The original number)
11 0 (Take the last digit of the number, and check if it is 0 or 5)
11 0 (If it is 0, take the remaining digits, discarding the last)
11 × 2 = 22 (Multiply the result by 2)
110 ÷ 5 = 22 (The result is the same as the original number divided by 5
What is the number divisible by 7 But not multiple by 5
To display all such numbers which are divisible by 7 but are not a multiple of 5, between 1000 and 2000
Algorithm:
- Step1. start
- Step2. define display function
- def display(n1,n2):
- Step3. In for Loop, check the condition i%7==0 and i%5!=0
- Step4. If the condition is a true print i value, Otherwise go to the next iteration.
- Step5. End
- What is the number divisible by 7?
- def display(n1,n2):
- for i in range(n1,n2+1):
- if(i%7==0 and i%5!=0):
- print(i)
- display(1000,2000)
What numbers are divisible by 7 but not multiple by 5
def display(n1, n2):
results = []
for i in range(1000, 2000+1):
if (i%7==0) and (i%5!=0):
results.append(i)
return results
n1 = 1000
n2 = 2000
print(display(n1,n2))
Output: Numbers divisible by 7 list but multiple by 5 list
“C:\Program Files\Python37\python.exe” C:/Users/user/.PyCharmCE2019.2/config/scratches/scratch.py
112, 119, 126, 133, 147, 154, 161, 168, 182, 189, 196, 203, 217, 224, 231, 238, 252, 259, 266, 273, 287, 294, 301, 308, 322, 329, 336, 343, 357, 364, 371, 378, 392, 399, 406, 413, 427, 434, 441, 448, 462, 469, 476, 483, 497, 504, 511, 518, 532, 539, 546, 553, 567, 574, 581, 588, 602, 609, 616, 623, 637, 644, 651, 658, 672, 679, 686, 693, 707, 714, 721, 728, 742, 749, 756, 763, 777, 784, 791, 798, 812, 819, 826, 833, 847, 854, 861, 868, 882, 889, 896, 903, 917, 924, 931, 938, 952, 959, 966, 973, 987, 994,
Process finished with exit code 0
Recommended Posts:
- How to Become a Machine Learning Engineers – easy Step by Step Guide
- Python Difference Between Two Lists using Python Set and Without Set
- How to Open file in python|Read File Line by Line with Examples
- Python String Find() Method Explained with Examples
- How to Generate Random Numbers in Python with Examples
Get Salesforce Answers
гѓ—гѓ¬гѓ‰гѓ‹гѓійЂљиІ©гЃЉгЃ™гЃ™г‚Ѓ – гѓ—гѓ¬гѓ‰гѓ‹гѓійЊ 40 mg еј·гЃ• г‚ўг‚ュテインは薬局で買える?