class Quis11
{
public static void main(String[] args)
{
int n = Integer.parseInt(javax.swing.JOptionPane.showInputDialog("Masukkan nilai N:"));
int baris = 0;
int kolom = 0;
for (baris=1; baris<=n; baris++)
{
for (kolom=1; kolom<=2*n; kolom++)
{
if (((baris % 2 == 0) && (kolom % 2 == 0)) ||
((baris % 2 != 0) && (kolom % 2 != 0)))
System.out.print("#");
else
System.out.print(".");
}
System.out.println();
}
}
}
{
public static void main(String[] args)
{
int n = Integer.parseInt(javax.swing.JOptionPane.showInputDialog("Masukkan nilai N:"));
int baris = 0;
int kolom = 0;
for (baris=1; baris<=n; baris++)
{
for (kolom=1; kolom<=2*n; kolom++)
{
if (((baris % 2 == 0) && (kolom % 2 == 0)) ||
((baris % 2 != 0) && (kolom % 2 != 0)))
System.out.print("#");
else
System.out.print(".");
}
System.out.println();
}
}
}
0 Responses so far.
Post a Comment