pesquisa

URI PROBLEMA 1133 - Resto da Divisão SOLUÇÃO EM PYTHON

URI Online Judge | 1133

Resto da Divisão

Adaptado por Neilor Tonin, URI  Brasil
Timelimit: 1
Escreva um programa que leia 2 valores X e Y e que imprima todos os valores entre eles cujo resto da divisão dele por 5 for igual a 2 ou igual a 3.

Entrada

O arquivo de entrada contém 2 valores positivos inteiros quaisquer, não necessariamente em ordem crescente.

Saída

Imprima todos os valores conforme exemplo abaixo, sempre em ordem crescente.



URI Online Judge | 1133

Rest of a Division

Adapted by Neilor Tonin, URI  Brazil
Timelimit: 1
Write a program that reads two integer numbers X and Y. Print all numbers between X and Y which dividing it by 5 the rest is equal to 2 or equal to 3.

Input

The input file contains 2 any positive integers, not necessarily in ascending order.

Output

Print all numbers according to above description, always in ascending order.










x = int(input())
y = int(input())

if x > y:
    a = y
    b = x
   
if x <= y:
    a = x
    b = y
a=a+1
while a < b:
    if a % 5 == 2 or a % 5 == 3:
        print(a)
    a = a + 1
    

Postar um comentário

0 Comentários