exercício matriz

3 respostas
R

Escreva um aplicativo em java que utiliza um laço para imprimir a seguinte tabela de valores:

N 10N 100N 1000*N
1 10 100 1000
2 20 200 2000
3 30 300 3000
4 40 400 4000
5 50 500 5000

3 Respostas

S

qual eh o problema? :space: :skol: :sleep

A

import java.io.*;
public class Aplicativo {

public static void main(String[] args) throws IOException {
    
    BufferedReader in = new BufferedReader (new InputStreamReader(System.in));
    
    //variaveis
    int i;
    int aux;
    //rodando
    System.out.print("Digite um número: ");
    aux = Integer.parseInt(in.readLine());
    for (i = aux; i <= aux+5; i = i+1) {
        System.out.println(aux+" - "+aux*10+" - "+aux*100+" - "+aux*1000);
    }
}

}

S

se n for isso eh quase isso!!!
eu ns ei se dar certo pq n to com o compilador java instalado aki!!!
entaum testa ae!!!

[b]

int vetor[][]=new vetor[1000][4];

int N=1;

for(int x=0;x<vetor.length;x++)

{

for(int y=0;y<vetor[0].length;y++)
{

if(y==0)

{

vetor[x][y]=N;

}

if(y==1)

{

vetor[x][y]=N<em>10;

}

if(y==2)

{

vetor[x][y]=N</em>100;

}

if(y==3)

{

vetor[x][y]=N*1000;

}

}

}

for(int x=0;x<vetor.length;x++)
{

for(int y=0;y<vetor[0].length;y++)

{

System.out.print(vetor[x][y]+" “);

}

System.out.print(”\n");

}[/b]
Criado 4 de maio de 2005
Ultima resposta 4 de mai. de 2005
Respostas 3
Participantes 3