{"id":8734,"date":"2023-11-04T11:11:19","date_gmt":"2023-11-04T05:41:19","guid":{"rendered":"https:\/\/python-programs.com\/?p=8734"},"modified":"2023-11-10T12:16:53","modified_gmt":"2023-11-10T06:46:53","slug":"python-program-to-print-all-numbers-in-a-range-divisible-by-a-given-number","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-print-all-numbers-in-a-range-divisible-by-a-given-number\/","title":{"rendered":"Python Program to Print all Numbers in a Range Divisible by a Given Number"},"content":{"rendered":"

Given three integers, the task is to print all values in the given range that are divisible by the third number, where the first number specifies the lower limit and the second number specifies the upper limit.<\/p>\n

Examples:<\/strong><\/p>\n

Example1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

lower limit = 1 \r\nupper limit = 263 \r\ngiven number = 5<\/pre>\n

Output:<\/strong><\/p>\n

The numbers which are divisible by 5 from 17 to 263 are:\r\n20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 105 110 115 120 125 130 135 140 145 150 155 160 165 \r\n170 175 180 185 190 195 200 205 210 215 220 225 230 235 240 245 250 255 260<\/pre>\n

Example2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Enter the lower limit = 37 \r\nEnter the upper limit = 217 \r\nEnter the given number = 3<\/pre>\n

Output:<\/strong><\/p>\n

The numbers which are divisible by 3 from 37 to 217 are:\r\n39 42 45 48 51 54 57 60 63 66 69 72 75 78 81 84 87 90 93 96 99 102 105 108 111\r\n114 117 120 123 126 129 132 135 138 141 144 147 150 153 156 159 162 165 168 \r\n171 174 177 180 183 186 189 192 195 198 201 204 207 210 213 216<\/pre>\n

Example3:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Enter the lower limit = 128\r\nEnter the upper limit = 659\r\nEnter the given number = 7<\/pre>\n

Output:<\/strong><\/p>\n

The numbers which are divisible by 7 from 128 to 659 are:\r\n133 140 147 154 161 168 175 182 189 196 203 210 217 224 231 238 245 252 259 266 273 280 287 294 301 308 \r\n315 322 329 336 343 350 357 364 371 378 385 392 399 406 413 420 427 434 441 448 455 462 469 476 483 490 \r\n497 504 511 518 525 532 539 546 553 560 567 574 581 588 595 602 609 616 623 630 637 644 651 658<\/pre>\n

Program to Print all Numbers in a Range Divisible by a Given Number in Python<\/h2>\n

There are several ways to print all the numbers in the given range which are divisible by the given number some of them are:<\/p>\n