Jump to content

Tabuada


caxinaswin
 Share

Go to solution Solved by FQueiros,

Recommended Posts

tenho o seguinte problema:

Implemente o metodo, com a seguinte assinatura static void tabuada(int n), que dado um numero inteiro, imprima a respetiva tabuada. Utilize o metodo num programa que peca numero inteiros ao utilizador e imprima as respectivas tabuadas. O programa deve terminar quando for inserido um zero.

fiz desta forma:

Scanner in = new Scanner(System.in);
int numero = 1;
while(numero != 0)
{
System.out.print("introduza a tabuada que pretende: ");
numero = in.nextInt();
tabuada(numero);
}


public static void tabuada(int n)
{
for(int i = 1;i<=10;i++)
{
System.out.println(n + "*" + i + "=" + (n*i));
}
}

A minha questão prende -se com o 0, eu não queria imprimir essa tabuada como faço????:S

Edited by apocsantos
tag code + geshi
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.