User Tools

Site Tools


dydaktyka:cprog:2016:functions-solutions

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
dydaktyka:cprog:2016:functions-solutions [2016/10/29 10:02]
pkleczek [Zadanie LOGOP-1]
— (current)
Line 1: Line 1:
-====== Funkcje - rozwiązania i odpowiedzi ====== 
- 
-Laboratorium:​ [[dydaktyka:​cprog:​2016:​functions]] 
- 
-===== Zadanie GREET ===== 
- 
-<code c greet.c> 
-#include <​stdio.h>​ 
-#include <​stdlib.h>​ 
- 
-void greet(int n) { 
-    int i; 
- 
-    for (i = 1; i <= n; i = i + 1) { 
-        printf("​Dzien dobry!\n"​);​ 
-    } 
-} 
- 
-int main() 
-{ 
-    greet(3); 
- 
-    return 0; 
-} 
-</​code>​ 
- 
- 
-===== Zadanie MAX ===== 
- 
-<code c max.c> 
-#include <​stdio.h>​ 
-#include <​stdlib.h>​ 
- 
-int max(int a, int b) { 
-    if (a > b) { 
-        return a; 
-    } else { 
-        return b; 
-    } 
-} 
- 
-int main() 
-{ 
-    int x1 = 4; 
-    int x2 = 8; 
- 
-    printf("​Wieksza z liczb %d i %d to %d.\n",​ x1, x2, max(x1, x2)); 
- 
-    return 0; 
-} 
-</​code>​ 
  
dydaktyka/cprog/2016/functions-solutions.1477728153.txt.gz · Last modified: 2020/03/25 11:46 (external edit)