Skip to content

Instantly share code, notes, and snippets.

@Fhernd
Created July 7, 2014 16:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fhernd/0901a752d9faa934482f to your computer and use it in GitHub Desktop.
Save Fhernd/0901a752d9faa934482f to your computer and use it in GitHub Desktop.
Cálculo del cuadrado y el cubo de 11 números enteros.
import java.util.Scanner;
// Clase definida por el programador
public class CuadradoCubo
{
// Método de clase
public static void main( String[] args )
{
System.out.printf( "\n Número\tCuadrado\tCubo" );
System.out.printf( "\n %d\t %d\t %d", 0 , ( 0 * 0 ) , ( 0 * 0 * 0 ) );
System.out.printf( "\n %d\t %d\t %d", 1 , ( 1 * 1 ) , ( 1 * 1 * 1 ) );
System.out.printf( "\n %d\t %d\t %d", 2 , ( 2 * 2 ) , ( 2 * 2 * 2 ) );
System.out.printf( "\n %d\t %d\t %d", 3 , ( 3 * 3 ) , ( 3 * 3 * 3 ) );
System.out.printf( "\n %d\t %d\t %d", 4 , ( 4 * 4 ) , ( 4 * 4 * 4 ) );
System.out.printf( "\n %d\t %d\t %d", 5 , ( 5 * 5 ) , ( 5 * 5 * 5 ) );
System.out.printf( "\n %d\t %d\t %d", 6 , ( 6 * 6 ) , ( 6 * 6 * 6 ) );
System.out.printf( "\n %d\t %d\t %d", 7 , ( 7 * 7 ) , ( 7 * 7 * 7 ) );
System.out.printf( "\n %d\t %d\t %d", 8 , ( 8 * 8 ) , ( 8 * 8 * 8 ) );
System.out.printf( "\n %d\t %d\t %d", 9 , ( 9 * 9 ) , ( 9 * 9 * 9 ) );
System.out.printf( "\n %d\t %d\t %d\n", 10 , ( 10 * 10 ) , ( 10 * 10 * 10 ) );
// Salida
System.exit(0);
} // Fin del método de clase
} // Fin de la clase definida por el programador
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment