Skip to content

Instantly share code, notes, and snippets.

@pepet96
Last active December 29, 2015 23:29
Show Gist options
  • Save pepet96/7743313 to your computer and use it in GitHub Desktop.
Save pepet96/7743313 to your computer and use it in GitHub Desktop.
Powers of Two
import java.util.Scanner;
import java.lang.*;
public class powersof {
public static void main (String [] args) {
Scanner input = new Scanner(System.in);
int x = 2;
int n = input.nextInt();
if (0 <= n && n <= 265) {
double sum = Math.pow(x,n);
System.out.println(sum);
}
else
System.out.println(0);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment