import java.io.*;
public class PowerOfTwo
{
public static void main(String a[]) throws IOException
{
System.out.println("Welcome to the PowerOfTwo project!");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int num = Integer.parseInt(br.readLine());
int flag=1;
if(num==0){
System.out.println("Not a power of two");
System.exit(0);
}
while(num!=1){
if(num%2!=0){
flag=0;
break;
}
num=num/2;
}
if(flag==0){
System.out.println("Not a power of two");
}
else
System.out.println("Power of Two");
}
}
public class PowerOfTwo
{
public static void main(String a[]) throws IOException
{
System.out.println("Welcome to the PowerOfTwo project!");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int num = Integer.parseInt(br.readLine());
int flag=1;
if(num==0){
System.out.println("Not a power of two");
System.exit(0);
}
while(num!=1){
if(num%2!=0){
flag=0;
break;
}
num=num/2;
}
if(flag==0){
System.out.println("Not a power of two");
}
else
System.out.println("Power of Two");
}
}
Comments
Post a Comment