Created
April 17, 2015 12:33
-
-
Save shigemk2/a024b5e532de58d5b0e0 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
void function(int n) { | |
int i, j, k , count = 0; | |
for(i = n/2; i <= n; i++) { | |
for(j = 1; j + n/2 <= n; j = j + 1) { | |
for(k = 1; k <= n; k = k * 2) { | |
count++; | |
printf("i: %d, j: %d, k: %d, count: %d\n", i, j, k, count); | |
} | |
} | |
} | |
} | |
main() { | |
function(8); | |
} |
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
object one25 { | |
def Function(n: Int): Unit = { | |
var count: Int = 0 | |
for(i <- n/2 to n; j <- 1 to n if j + n/2 <= n; k <- Iterator.iterate(1)(_ * 2) takeWhile (_ <= n)) { | |
count = count + 1 | |
printf("i: %d, j: %d, k: %d, count: %d\n", i, j, k, count) | |
} | |
} | |
def main(args: Array[String]) { | |
Function(8); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment