Bienvenido: ( Identificarse | Registrarse )      
Foros de Trucos Windows
Closed TopicStart new topicStart Poll

Outline · [ Estándar ] · Lineal+

> Ayuda en Java

Marzzipan
post May 5 2007, 04:08 PM
Publicado: #1


Miembro
**

Grupo: Members
Mensajes: 44
Registrado: 21-July 06
Miembro nº: 174.802



Bueno resulta que tengo que hacer un programa que haga la primeras 12 tablas de multiplicar y bueno la verdad lo intente pero no eh podido hasta ahora ya que uso metodos:

public class Tablas{
static final int multiplicador=12;
static final int multiplicante=10;
static String espacio="\t\t";
public static void main (String[]args){
System.out.println("Tabla de Multiplicar");
System.out.println(" ");
for(int num=1;num<multiplicante;num++)
System.out.println("Tabla del "+num);
System.out.println(" ");
for(int linea =0;linea<multiplicador;linea++)
implinea(linea);
}
static void implinea(int esta){
for(int num=0;num<multiplicante;num++){
int a=esta*multiplicador+num;
System.out.println(Result + espacio);
}
System.out.println(" ");
}
static int Result(int total){
return Math.round(total=multiplicador*multiplicante);
}

}

La verdad no quisiera que lo hicieran sino que me expliquena como imprimir en la pantalla por ejemplo:

1 x 1 = 1
1 x 2 = 2
1 x 3 = 3....etc

Se me hace muy dificil ya que como dije devo usar metodos.
Saludos a todos y gracias por su tiempo.


User is offlineProfile CardPM
Go to the top of the page
+Quote Post
cyberfranko
post May 5 2007, 07:02 PM
Publicado: #2


G*FranKo
***

Grupo: Members
Mensajes: 85
Registrado: 15-November 06
Miembro nº: 186.314



Q tal man bueno entiendo q necesitas q te expliken pero voy de salida te dejo en cod, ps esta muy facil d entender asi q si te sirve en buena hora biggrin20jy.gif biggrin20jy.gif
CODE

import java.awt.event.*;
import java.awt.*;
import javax.swing.*;

public class Tabla {


public static void main(String[] args) {
 System.out.println("Tablas de Multiplicar");
 getTabla();
}

public static void getTabla(){
 int Max=12,Min=1;
 
 for(;Min<Max;Min++){
  Operar(Min);
 }
 
}

public static void Operar(int x){
 System.out.println(" ");
 System.out.println("Tabla del " + x + "\n");
 
 for (int i=0;i<12;i++)
  System.out.println(x + " x " + i + " = " +(x*i));
}
}



User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Marzzipan
post May 6 2007, 05:33 PM
Publicado: #3


Miembro
**

Grupo: Members
Mensajes: 44
Registrado: 21-July 06
Miembro nº: 174.802



clap.gif Muchísimas gracias, funcionó a la perfección biggrin.gif .


User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
Closed TopicTopic OptionsStart new topic

Collapse

> Topicos similares

Ayuda, ordenador arranca pero se apaga en cuest ... titometal 32 4 Hoy, 02:42 PM
By: Aitor_sp
Ayuda con cortafuegos narutobigit 95 1 Hoy, 02:15 PM
By: Mau85
Mi Log de Hijackthis... AYUDA! Boogie1989 85 6 Hoy, 09:52 AM
By: Caito
AYUDA URGENTE ! No quiere iniciar desde el CD. lost666 153 11 Ayer, 10:08 PM
By: Aitor_sp
ayuda con dreamule cazafantasma 106 4 Ayer, 03:04 PM
By: anmogin