(URI) Quadrado e ao Cubo - Solution
import java.io.*;
class Main {
public static void process() throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int num = Integer.parseInt(br.readLine());
for (int i = 1; i <= num; i++) {
int pow2 = i*i;
int pow3 = pow2*i;
System.out.println(i + " " + pow2 + " " + pow3);
}
return;
}
public static void main(String[] args) throws NumberFormatException, IOException {
Main m = new Main();
m.process();
System.exit(0);
}
}
class Main {
public static void process() throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int num = Integer.parseInt(br.readLine());
for (int i = 1; i <= num; i++) {
int pow2 = i*i;
int pow3 = pow2*i;
System.out.println(i + " " + pow2 + " " + pow3);
}
return;
}
public static void main(String[] args) throws NumberFormatException, IOException {
Main m = new Main();
m.process();
System.exit(0);
}
}
Comments
Post a Comment