#include<iostream>
using namespace std;
int main()
{
int number;
double sum=0;
cout<<"Enter the Value of the maximum number : ";
cin>>number;
for(double i=1; i<=number; i++)
{
double fraction=1/i;
sum=sum+fraction;
}
cout<<"Sum of the series : "<<sum<<endl;
return 0;
}
using namespace std;
int main()
{
int number;
double sum=0;
cout<<"Enter the Value of the maximum number : ";
cin>>number;
for(double i=1; i<=number; i++)
{
double fraction=1/i;
sum=sum+fraction;
}
cout<<"Sum of the series : "<<sum<<endl;
return 0;
}
No comments:
Post a Comment