# Commits

committed db51a64

Exercises for week 2 (18/03/2011)

- Find max (in couples)
- Recursive Factorial

# Files changed (4)

• Ignore whitespace
• Hide word diff
`+syntax: glob`
`+**.exe`

• Ignore whitespace
• Hide word diff
`     if(y==0)`
`         return x;`
`     else`
`-    {`
`         return mkd(y, x%y);`
`-    }`
` }`

• Ignore whitespace
• Hide word diff
`+/*`
`+  Name: Raptis Nikolaos`
`+  AM: 1550`
`+  Omada: Paraskeyi 16-18 `
`+  Date: 18/03/11 17:00`
`+  Description: Eyresi megistou ana zeygaria`
`+*/`
`+#include <stdio.h>`
`+#include <stdlib.h>`
`+`
`+#define N 10`
`+`
`+main()`
`+{`
`+    int A[N], max, thesi, i;`
`+    `
`+    //Eisagwgi timwn`
`+    for(i=0; i<N; i++)`
`+    {`
`+        printf("Eisagete arithmo gia A[%2d] : ", i+1);`
`+        scanf("%d", &A[i]);`
`+    }`
`+    `
`+    //Arxikopoiisi algorithmou`
`+    if(A[0]>=A[1])`
`+    {`
`+        max = A[0];`
`+        thesi = 0;`
`+    }`
`+    else`
`+    {`
`+        max = A[1];`
`+        thesi = 1;`
`+    }`
`+    `
`+    //Eyresi megistou`
`+    for(i=2; i<N; i+=2)`
`+    {`
`+        if(A[i]>=A[i+1])`
`+        {`
`+            if(A[i]>max)`
`+            {`
`+                max = A[i];`
`+                thesi = i;`
`+            }`
`+        }`
`+        else`
`+        {`
`+            if(A[i+1]>max)`
`+            {`
`+                max = A[i+1];`
`+                thesi = i+1;`
`+            }`
`+        }`
`+    }`
`+    `
`+    //Ektypwsi apotelesmatos`
`+    printf("\nO megistos einai o %d sti thesi %d\n", max, thesi+1);`
`+    `
`+    system("pause");`
`+`
`+}`

• Ignore whitespace
• Hide word diff
`+/*`
`+  Name: Raptis Nikolaos`
`+  AM: 1550`
`+  Omada: Paraskeyi 16-18 `
`+  Date: 18/03/11 21:15`
`+  Description: Paragontiko me anadromi`
`+*/`
`+#include <stdio.h>`
`+#include <stdlib.h>`
`+`
`+int parag(int x);`
`+`
`+main()`
`+{`
`+    int x;`
`+    `
`+    do`
`+    {`
`+        printf("Eisagete ena thetiko akeraio : ");`
`+        scanf("%d", &x);`
`+    } while(x<0);`
`+    `
`+    printf("\nTo paragontiko tou einai:\n");`
`+    printf(  "%d! = %d\n\n", x, parag(x));`
`+`
`+    system("pause");`
`+`
`+}`
`+`
`+int parag(int x)`
`+{`
`+    if(x==0)`
`+        return 1;`
`+    else`
`+        return x*parag(x-1);`
`+}`