#include <stdio.h>
int folgenglied(int);
int main(){
int n, m;
printf("Type a number in\n");
scanf("%d", &n);
m = folgenglied(n);
printf("%d ist the Folgenglied", m);
}
int folgenglied(int n) {
int x;
x = 1 / (n + 2);
return x;
}
I want to write the result of the folgenglied
in the second printf
call, but it always prints out 0. I don’t understand what’s wrong with my code.