Question: Code:

```
public static void main(String... args){
    Scanner sc = new Scanner(System.in);
    int count =0;
    int a= sc.nextInt();
    int b =sc.nextInt();
    if(a>b){
        //int count =0;
        for(int i =1;i<=a;i++){
            if(a/i == 0 && b/i == 0){
                count++;
                System.out.println(count);
            }
        }
    }else if(a<b){
        //int count =0;
        for(int i=1;i<=b;i++){
            if(a/i == 0 && b/i == 0){
                count++;
                System.out.println(count);
            }
        }
    }
}

```

1. I am not getting any output what is error?
2. I want to take input from user and then find the number of common factors.

Answer: 
Lets be more precise.
If a < b then simple test for 
1. numbers<=a/2
2. whether a divide b
3. if any number is zero no need to find factors simply count 0
as shown here,

```
   Scanner s = new Scanner(System.in);
    long n = s.nextLong();   
    long m=s.nextLong();
    int small=0;
    int count=0;

    if(n==0 || m==0){
        System.out.println(count);
        return;

    }

    if(n<m) 
       small=(int)n/2;
   else
    small=(int)m/2;

     count=1;

    for(int i=2;i<=small;i++){
        if(n%i==0 && m%i==0)
        count++;
    }
   if(n%m==0 || m%n==0)count++;

    System.out.println(count);    

```
```
if((a/i == 0)&&(b/i == 0))

```

This condition is wrong -- `a / i` will only ever be zero if `a` is zero, or if it's less than `i`. This is clearly not what you want.

What you need here is the modulus operator, `%`, which returns the remainder when dividing its two operands by each other.

```
if((a%i == 0)&&(b%i == 0))

```

With this change made in both locations, your program appears to work correctly.