summaryrefslogtreecommitdiff
path: root/miniany/hello.c
blob: 67cfe1d6b47fa3680453eaf9afd1643834bf1d3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <stdio.h>

int f1(int x);

int f2(int x)
{
  if(x==1) return 0;
  f1(x-1);
}

int f1(int x)
{
  if(x==1) return 0;
  f2(x-1);
}

int f(int x)
{
  if(x==0) return 0;
  if(x==1) return 1;  
  return f(x-1)+f(x-2);
}

int main()
{
  char *s;
  s = (char *)malloc(50);
  (void)strlcpy(s,"hello, ",50);
  (void)strlcat(s,"world",50);
  putstring(s);
  putnl();
  free(s);
  putint(f(10));
  putnl();
  putint(f1(10));
  putnl();
  return 0;
}