Computer Science, asked by poojamohan9513, 10 months ago

can anyone write a c program for multiple of N till divisible by X

Answers

Answered by Ananya1514
0

Answer:

Explanation:

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);

  }

 }

}

Similar questions