Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » BeginnersRSS Feeds

Program to harmonic series

Posted By: Rosie Hughes     Category: C Programming     Views: 8055

Write a program to harmonic series.

Code for Program to harmonic series in C Programming

#include<stdio.h>
#include<conio.h>

void main()
{
    int n;
    float i=0,sum=0;
    clrscr();

    printf("Enter the value of series :- ");
    scanf("%d",&n);

    for(i=1;i<=n;i++)
    {
        sum = sum + 1/i;

    }
        printf("The Answer is :- %f",sum);

getch();
}
  
Share: 


Didn't find what you were looking for? Find more on Program to harmonic series Or get search suggestion and latest updates.

Rosie Hughes
Rosie Hughes author of Program to harmonic series is from London, United Kingdom.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!