Advertisement
MayurTolani

divisible by two numbers at a time

Oct 29th, 2013
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.37 KB | None | 0 0
  1. import java.util.Scanner;
  2. class DivisibleByTwoNumbers{
  3.     public static void main(String a[])
  4.     {
  5.         Scanner sc=new Scanner(System.in);
  6.         System.out.print("enter the two numbers : ");
  7.         int m=sc.nextInt();
  8.         int n=sc.nextInt();
  9.         int count=0;
  10.         for(int i=1;count<10;i++){
  11.             if(i%m==0 && i%n==0)
  12.                 {
  13.                     System.out.print(i+" ");
  14.                     count++;
  15.                 }
  16.  
  17.         }
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement