suma 1/n

//1+1/2+…1/n
#include<iostream.h>
#include<conio.h>

float e(int k)
{
if (k==1) return 1;
else return (float)1/k+e(k-1);
}

void main()
{
int n;
cout<<“n=”;cin>>n;
cout<<e(n)<<endl;
getch();
}

{module orizontal600}

Leave a Comment