import java.io.*;
class Ore
{
public static void main(String args[])throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter the number: ");
int num = Integer.parseInt(br.readLine());
int f = 0;
double mean = 0.0;
for(int i = 1; i <= num; i++)
{
if(num % i == 0)
{
f++;
mean += 1.0 / i;
}
}
mean = f / mean;
if(mean == (int)mean)
System.out.println(num + " is an Ore Number.");
else
System.out.println(num + " is NOT an Ore Number.");
}
}
No comments:
Post a Comment
any problem in any program comment:-