Java :: Aufgabe #278

4 Lösungen Lösungen öffentlich

Das kleine Einmaleins

Anfänger - Java von DragStar - 06.04.2020 um 08:32 Uhr
Erstellen Sie ein Programm, welches das kleine Einmaleins in der Form
1 2 3 4 5 6 7 8 9 10
2 4 6 8 10 12 14 16 18 20
3 ...
.
.
.
10 20 30 40 50 60 70 80 90 100
ausgibt.

Lösungen:

vote_ok
von Meckel (350 Punkte) - 12.04.2020 um 11:43 Uhr
Quellcode ausblenden Java-Code
public class main {
	public static void main(String[] args) {
		for(int i=1; i<=10; i++) {
			for(int j=1; j<=10; j++) {
				if(j<10) {
					System.out.print(i*j+" ");
				} else {
					System.out.println(i*j);
				}
			}
		}

	}
}
1x
vote_ok
von Akinnej (60 Punkte) - 14.04.2020 um 17:15 Uhr
Quellcode ausblenden Java-Code
public class Main {

    public static void main(String[] args) {
        new Main().multiplicator();
    }

    public void multiplicator(){
        int [][] array = new int[10][10];
        for (int i = 1; i <= 10; i++) {
            for (int j = 1; j <= 10; j++) {
                array[i-1][j-1] = i*j;

            }

        }
        for ( int i = 0; i < array.length; i++ )
        { for ( int j=0; j < array[i].length; j++ )
                System.out.print( array[i][j] + " ");
            System.out.println();
        }
    }

}
vote_ok
von daniel91 (150 Punkte) - 16.04.2020 um 17:06 Uhr
Quellcode ausblenden Java-Code
public class Einmaleins {

	public static void main(String[] args) {
		
		int N = 10;
		
		// Schleife über alle Zahlen, die miteinander multipliziert werden
		for(int ix = 1; ix <= N; ix++) {
			for(int iy = 1; iy <= N; iy++) {
				System.out.printf("%4s", ix*iy);
			}
			// Zeilenumbruch am Ende einer Zeile erzeugeni
			System.out.println(); 
		}
		
	}

}
1x
vote_ok
von TheFirstLuc (280 Punkte) - 29.04.2020 um 17:43 Uhr
Quellcode ausblenden Java-Code
public class num {
	public static void main(String args[]) {
		int[] width = new int[11];
		int[] height = new int[11];
		
		//occupy
		for(int i=0;i<width.length; i++) {
			width[i]=i;
		}
		for(int i=0;i<height.length; i++) {
			height[i]=i;
		}
		
		//calculate
		for(int i=1;i<height.length;i++) {
			for(int j=1;j<width.length;j++) {
				System.out.print(width[j]*height[i]+" ");
				if(j == 10) {
					System.out.println("\n");
				}
			}
		}
	}
}