#include<conio.h>
#include<stdio.h>
int main()
{
float ans=0.0;
int terms,i=1;
printf("Enter no of terms");
scanf("%d",&terms);
while(i<=terms)
{
ans = ans+(float)1/i;
i++;
}
CPU-2110003 CPU Program
V.V.P Engineering College Developed By: Tejas Rupani
printf("\nans is: %f",ans);
}
#include<stdio.h>
int main()
{
float ans=0.0;
int terms,i=1;
printf("Enter no of terms");
scanf("%d",&terms);
while(i<=terms)
{
ans = ans+(float)1/i;
i++;
}
CPU-2110003 CPU Program
V.V.P Engineering College Developed By: Tejas Rupani
printf("\nans is: %f",ans);
}
No comments:
Post a Comment