0

I read an int numer from the user. I should calculate all numbers which have mod1 until numer is reached. The program should write them one by one.

public class meraba {

public static void main(String[] args) {

    int number;
    @SuppressWarnings("resource")
    Scanner input = new Scanner(System.in);
    System.out.println("Sayı girin");
    number = input.nextInt();

    for (int i = 0; i < 0; i++) {
        if (number == i) {
            for(int d = 0;d<number;d++){

            }
            break;
        }
    }
}
}

I couldn't get it to do that.

I'm looking forward to a correct solution in java.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Jas
  • 11
  • 2

1 Answers1

0
public class meraba {

public static void main(String[] args) {

    int number;
    @SuppressWarnings("resource")
    Scanner input = new Scanner(System.in);
    System.out.println("Sayı girin");
    number = input.nextInt();

    for (int i = 2; i < number; i++) {
        if (number % i == 1) {
          System.out.println("Mod 1 condition satisfies: " + i);
        }
    }
}
}

I hope, I understood your question very well ;)

Manish Singh
  • 518
  • 3
  • 13