#include<conio.h>
#include<stdio.h>
void main()
{
double i, n, sum = 0;
clrscr();
printf("enter the
number:");
scanf("%lf",&n);
for(i=1;i<=n;i++)
{
sum = sum + (1/i);
if(i==1)
printf("\n
1 + ");
else
if(i==n)
printf("(1/%lf)",i);
else
printf("(1/%lf)
+ ",i);
}
printf("\n
= %.2lf",sum);
getch();
}
there is no output......
ReplyDeleteoutput required
ReplyDelete