Skip to content
Snippets Groups Projects
Commit 0ec72f6f authored by Sandro Stephan Rufibach's avatar Sandro Stephan Rufibach
Browse files

fiborek.c erstellt

parent f131a30b
Branches
No related tags found
No related merge requests found
// Praktikum 13, Aufgabe Nr. 2: Fibonacci-Zahl rekursiv
// Datei 'fiborek.c' 11.12.2024, Sandro Rufibach
//----------------------------------------------
#include <stdio.h> // Für scanf(), printf ()
unsigned long long getfiborec(int Anzahl);
int main (void)
{
int Anzahl;
printf("Heute Berechnen wir die Fibonacizahl, gib bitte die Anzahl stellen an die wir berechnen:");
scanf("%d", &Anzahl);
unsigned long long Zahl = getfiborec(Anzahl);
printf("%llu\n", Zahl);
}
unsigned long long getfiborec(int Anzahl)
{
if(Anzahl <= 2)
{
return 1;
}
else
{
return getfiborec(Anzahl-1) + getfiborec(Anzahl-2);
}
}
\ No newline at end of file
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment