Evil Number

import java.io.*;
class Evil
{
public static void main() throws IOException
{
BufferedReader y = new BufferedReader(new InputStreamReader(System.in));
int n,r,c=0;
System.out.println(“Enter a number”);
n=Integer.parseInt(y.readLine());

while(n>0)
{
r=n%2;
if(r==1)
c++;
n=n/2;
}

if(c%2==0)
System.out.println(“Evil Number”);
else
System.out.println(“Odious Number”);
}
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s