treść zadania w załączniku
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package cwiczeniaa;
import java.util.Scanner;
/**
*
* @author Krzysiek
*/
public class Cwiczeniaa {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n;
do{
n=in.nextInt();
}while(n<=0);
boolean[][] a=new boolean[n][n];
int ilDziel=0;
for(int i=0;i<n; i++){
for(int j=0; j<n; j++){
for(int k=1; k<=n; k++){
if((i+1)%k==0 && (j+1)%k==0)ilDziel++;
}
if(ilDziel>1)a[i][j]=false;
ilDziel=0;
}
}
for(int i=0; i<n; i++){
for(int j=0; j<n; j++){
if(a[i][j]==true)System.out.print("+ ");
else System.out.print("- ");
}
System.out.println();
}
}
}