khoob

sss
mail@pastecode.io avatar
unknown
java
a year ago
808 B
1
Indexable
Never
package PAC1;

import java.util.Scanner;

public class C5 {


    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        System.out.println("adad ra vared konid :");
        int number = sc.nextInt();
        int counter = 0;
        int x = 1;
        int y = 1;
        System.out.println(khoob(x, y, counter, number));
    }

    public static int khoob(int x, int y, int counter, int number)
    {
        for(int i=y;x>=i;i++)
        {
            if(x%i==0)
            {
                counter++;
            }
        }

        if (counter == number) {
            return x;
        }
        else
        {
            counter = 0;
            return khoob(x + 1, y, counter, number);
        }

    }

    }