Commit 88e52e78 authored by Kopp Markus's avatar Kopp Markus Committed by Alexander Hirsch
Browse files

Fix errors in mC example inputs (thanks Markus)

parent 14da3497
int calculateFactorial(int number){
int factorial = 1;
int i = 1;
int factorial;
factorial = 1;
int i;
i = 1;
while (i <= number){
factorial *= i;
factorial = factorial * i;
i = i + 1;
}
return factorial;
......
......@@ -33,7 +33,8 @@ int main() {
print_nl();
b = read_int();
int res = gcd(a,b);
int res;
res = gcd(a,b);
print("The greatest common divisor is: ");
print_int(res);
......
......@@ -2,7 +2,8 @@
bool is_square(int n)
{
int i = 0;
int i;
i = 0;
while(i*i < n){
if(i*i == n){
return true;
......
int returnTwo() {
int value = 2;
int value;
value = 2;
return value;
}
......@@ -13,7 +14,8 @@ bool isOne(int in) {
int main() {
int[42] array;
int[21] arrayTwo;
int i = 0;
int i;
i = 0;
while (i < 21) {
array[i] = i*i;
i = i + 1;
......@@ -30,7 +32,7 @@ int main() {
if (array[0] == 0) {
print_int(array[0]);
print_nl();
}
}
if (array[1] == 2) {
print_int(0);
......
......@@ -31,7 +31,8 @@ int main() {
input = read_int();
print_nl();
bool result = is_palindrome(input);
bool result;
result = is_palindrome(input);
print_int(input);
if (result) {
......
......@@ -97,12 +97,13 @@ int main(){
print("give a sequence of 10 numbers to be sorted: ");
print_nl();
int arr_size = 10;
int arr_size;
arr_size = 10;
int i;
i=0;
if (is_int){
int i_arr[arr_size];
int[10] i_arr;
int i_number;
while(i < arr_size){
print_int(i);
......@@ -124,7 +125,7 @@ int main(){
print("output array: ");
print_i_array(i_arr, arr_size);
}else{
float f_arr[arr_size];
float[10] f_arr;
float f_number;
while(i < arr_size){
......
......@@ -4,8 +4,10 @@ int main(){
print_nl();
int n;
n = read_int();
bool a = 1 <= n;
bool b = 2 == n;
bool a;
a = 1 <= n;
bool b;
b = 2 == n;
b = 3 >= n;
n = n * 2;
n = n / 2;
......@@ -15,9 +17,12 @@ int main(){
a || b;
a != !b;
int[3] test;
string hi = "Hello";
float f = -1.0;
bool c = true;
string hi;
hi = "Hello";
float f;
f = -1.0;
bool c;
c = true;
if (c)
{
while(c){
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment