class twonummulti_equalto_x
{
public static void main(String[] args)
{
int x = 21;
int[] arr = {4, 7, 3, 2, 4, 7, 6, 5, 2};
Set
for (int i=0; i
set.add(arr[i]);
}
Iterator
while (itr.hasNext())
{
int i = itr.next();
int div = x/i;
int mod = x%i;
if (mod==0 && set.contains(div))
{
System.out.println(i+"x"+div+"="+x);
}
}
}
}
No comments :
Post a Comment