and this for the last excercise:
public static void main(String [] args){
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try {
System.out.print("Put a value: ");
String s = br.readLine();
int val = Integer.parseInt(s);
System.out.println();
for (int j = val; j > 0; j--){
for(int i = 1; i <= j; i++){
System.out.print( i + " ");
}
System.out.println("");
}
br.close();
} catch (IOException e) {
e.printStackTrace();
}
}