Commit d42588b2 by trkall

kodu2

parent fd1ae2a3
#include <stdio.h>
int fibo(int, int);
int main(void)
{
int n = 47;
char koer[20];
int a = 0;
int b = 1;
int c;
int i;
printf("%d\n%d\n", a, b);
for(i=2;i<n;i++)
{
c = fibo(a, b);
a = b;
b = c;
printf("%d\n", b);
}
return 0;
}
fibo(int y, int x)
{
return y + x;
}
#include <stdio.h>
#include <stdlib.h>
/*
1. klaviatuurilt sisestatakse reaalarvulised X (|X|<1) ja e (0<e<1);
2. rekursiivse funktsiooni abil moodustatakse reaalarvuline massiiv A
elementidega
A1 = X,
A2 = X^3/3,
A3 = X^5/5,
. . .
kuni massiivi A elementide arv L kas vastab tingimusele |A[L] – A[L–1]| <=e või (kui see tingimus ei ole rahuldatud) L = 15;
3. faili F väljastatakse massiivi A elementide arv L ning elemendid
koos indeksitega.
*/
double aste(double, int);
double reku(double);
double absolutevodka(double);
int main(void)
{
double x;
double e;
double* A = (double*)malloc(sizeof(double*));
printf("Sisestage x:");
scanf("%lf", &x);
printf("\nSisestage e:");
scanf("%lf", &e);
}
#include <stdio.h>
int fibonacci(int);
int main(void)
{
int n = 15;
int i;
for(i=0;i<n;i++)
{
printf("%d\n", fibonacci(i));
}
return 0;
}
int fibonacci(int n)
{
if(n == 1)
{
return 1;
} else if(n == 0)
{
return 0;
} else{
return (fibonacci(n-1) + fibonacci(n-2));
}
}
#include <stdio.h>
int factorial(int);
int main(void)
{
int x = 6;
x = factorial(x);
printf("%d", x);
return 0;
}
int factorial(int x)
{
if(x == 1){
return 1;
}
x *= factorial(x-1);
return x;
}
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 sign in to comment