Skip to content

Instantly share code, notes, and snippets.

@alireza-ahmadi
Forked from reshadman/Loop.java
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alireza-ahmadi/8c58f68198b2655753b4 to your computer and use it in GitHub Desktop.
Save alireza-ahmadi/8c58f68198b2655753b4 to your computer and use it in GitHub Desktop.
#include <stdio.h>
void main(int argc, char *argv[]){
int i = 0;
int total = 500000000;
int chunked = 50000000;
while(total > i)
{
if(i % chunked == 0) printf("%d\n", i);
i++;
}
}
package main
import "fmt"
func main() {
var total, chunk, i int32
total = 500000000
chunk = 50000000
i = 0
for i < total {
if i%chunk == 0 {
fmt.Printf("%d\n", i)
}
i++
}
}
public class Loop {
public static void main(String[] args)
{
Integer total = 500000000;
Integer chunk = 50000000;
Integer i = 0;
while(i < total)
{
if(i % chunk == 0)
{
System.out.println(i);
}
i++;
}
}
}
var total = 500000000;
var chunk = 50000000;
var i = 0;
while(i < total)
{
if(i % chunk == 0) console.log(i);
i++;
}
<?php
$i = 0;
$total = 500000000;
$chunk = 50000000;
while ($i < $total)
{
if($i % $chunk == 0) echo "i : " . $i . "\n";
$i++;
}
?>
total = 500000000
chunk = 50000000
i = 0
while (i < total):
if(i % chunk == 0)
print('i: ',i)
i = i + 1
total = 500000000
chunk = 50000000
i = 0
while i < total
if i % chunk == 0
print "i: ", i, "\n"
end
i += 1
end
var i = 0;
val total: Int = 500000000;
val chunk: Int = 50000000;
while(i < total)
{
if(i % chunk == 0) println(i);
i += 1;
}
#!/bin/bash
total=500000000;
chunked=50000000;
i=0;
while [[ $i -lt $total ]]; do
if [[ $(($i % $chunked)) -eq 0 ]]; then
echo $i
fi
i=$((i+1))
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment