Beispiel #1
0
int main(){
	printf("Cards  Overhang\n");
	int n;
	while (scanf("%d", &n) != EOF) {
		printf("%5d%10.3f\n",n, harmonicNumber(n) / 2.0);
	}
	return 0;
}
int main(int argc, char const *argv[])
{
	int n;

	printf("Informe um número inteiro:");
	scanf("%d",&n);

	printf("H(%d) = %.3f\n",n,harmonicNumber(n));

	return 0;
}
float harmonicNumber(int n){
	return (n == 1)?((float)1/n):(float)1/n + harmonicNumber(n-1);
}