Created
June 7, 2018 04:51
-
-
Save thmain/80c9fa81ea7ce63c07d2fa468d0d0413 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Logn { | |
static void computeLogN(int n){ | |
int result = 0; | |
int number = n; | |
while(n>0){ | |
n=n/2; | |
if(n>=1) | |
result++; | |
} | |
System.out.println("Log"+number + " value: " + result); | |
} | |
public static void main(String[] args) { | |
int n = 64; | |
computeLogN(n); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment