TOPIC

Erro de 30% onde ?

ecdslima asked 4 years ago

Gente o bloco de codigo python abaixo realiza perfeitamente a tarefa proposta, podem jogar em qualquer interpretador, mas aqui fica dando erro, o problema deveria ao menos informar que tipo de estrutura podemos usar, ninguem consegue adivinhar as coisas.


 #Forma 1

teste = 7, 6, 5
i = 1

while i < 10:
    for n in range(0, 3):
        print('I=%d J=%d' %(i, teste[n]))
    i = i + 1

#Forma 2 de fazer a mesma coisa:
teste = (7, 6, 5)

for i in (1, 2, 3, 4, 5, 6, 7, 8, 9):
        for x in range(3):
            print('I=%d' %(i), end=' ')
            print('J=%d' %teste[x])

Remember not post solutions. Your post may be reviewed by our moderators.

  • nchanakya replied 4 years ago

    include

    int main() {

    /**
     * Escreva a sua solução aqui
     * Code your solution here
     * Escriba su solución aquí
     */
    int i=1,j=7;
    while(i<=9)
    {
        for(int k=1;k<=3;k++)
        {
            printf("I=%d J=%d\n",i,j);
            j=j-1;
        }
        j=7;
        i=i+2;
    
    }
    return 0;

    }

  • shyldbakk replied 4 years ago

    I = 1, 3, 5, 7, 9 not 1, 2, 3, 4, 5, 6, 7, 8 ,9

  • emartins46 replied 4 years ago

    O "I" tem que variar de 2 em 2. Ele tem que ser 1, 3, 5, 7 e 9.