Computer Science, asked by tamnaypal5214, 9 months ago

Write a program to print n multiples of x in Java

Answers

Answered by pratikshabhagwat97
0

Answer:

import java.util.*;

class multipleN_X

{

public static void main(String[] aars)

{

 Scanner input = new Scanner(System.in);

 System.out.print("N = ");

 int N = input.nextInt();

 System.out.println();

 System.out.print("X = ");

 int X = input.nextInt();

 

 System.out.println("Mutiples Of N ");

 for(int i=1;i<=N;i++)

 {

  int k=i*N;

  if(k%X == 0)

  {

   System.out.println(X+"is divisible by "+k+" So loop stops ");

   break;

  }

  else

  {

   System.out.println(k);

  }

 }

}

}

Explanation:

Answered by Anonymous
0

..............................................................................................................................................................................................................................................................................................................

Explanation:

Similar questions