top of page
Wave
Cactus%20Plant_edited.jpg

S = 1 + 1/2 + 1/3 +...+ 1/ N

#include<stdio.h>
int main()
{
    int n;
    float i=1.0,s=0.0;
    printf("Enter the value of n: ");
    scanf("%d",&n);
    while(i<=n)
    {
        s=s+(i/(i+1));
        i=i+1;
    }
    printf("Sum is => %.2f",s);
    return 1;
}

Subscribe Form

Thanks for submitting!

  • Facebook
  • YouTube
  • Instagram
  • Twitter

©2020 by Abhisek Midya ( A18 )

bottom of page