Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package softuni.homework.problem9;
- import java.util.Scanner;
- public class HitTheTarget {
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- int target = input.nextInt();
- for (int i = 1; i <= 20 ; i++) {
- for (int j = 1; j <= 20 ; j++) {
- if ( i + j == target){
- System.out.printf("%d + %d = %d\r\n", i, j, target);
- }
- if (i - j == target) {
- System.out.printf("%d - %d = %d\r\n", i, j, target);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement