Add example inputs

This commit is contained in:
Alex Hirsch
2019-01-06 12:11:47 +01:00
parent 0045501c5e
commit bd7fae8198
36 changed files with 624 additions and 0 deletions

35
examples/prime/prime.mc Normal file
View File

@@ -0,0 +1,35 @@
int is_prime(int n){
int i;
i = 2;
int mod;
while (i < n/2)
{
mod = n - (n/i)*i;
if(mod == 0){
return 0;
}
i = i +1;
}
return 1;
}
int main()
{
print("Please enter a number: ");
int n;
n = read_int();
print_nl();
int result;
result = is_prime(n);
print("prime(");
print_int(n);
print(") = ");
print_int(result);
print_nl();
return 0;
}

View File

@@ -0,0 +1 @@
11

View File

@@ -0,0 +1,2 @@
Please enter a number:
prime(11) = 1