Skip to content
Programmingoneonone
Programmingoneonone
  • Engineering Subjects
    • Internet of Things (IoT)
    • Digital Communication
    • Human Values
  • Programming Tutorials
    • C Programming
    • Data structures and Algorithms
    • 100+ Java Programs
    • 100+ C Programs
    • 100+ C++ Programs
  • Solutions
    • HackerRank
      • Algorithms Solutions
      • C solutions
      • C++ solutions
      • Java solutions
      • Python solutions
    • Leetcode Solutions
    • HackerEarth Solutions
  • Work with US
Programmingoneonone
Programmingoneonone

C Program to display the sum of the harmonic series

YASH PAL, 31 July 202419 February 2026

In this tutorial, we are going to write a C Program to display the sum of harmonic series 1+1/2+1/3+…+1/n in C Programming with practical program code and step-by-step full complete explanation.

C Program to display the sum of harmonic series 1+1/2+1/3+...+1/n

C Program to display the sum of harmonic series.

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

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

	clrscr();

	printf("Enter any number: ");
	scanf("%d",&n);
	printf("1 +");

	for(i=2;i<=n-1;i++)
	{
		printf(" 1/%d +",i);
	}
	for(i=1;i<=n;i++)
	{
		sum=sum+i;
	}
	printf(" 1/%d",n);
	printf("nSum=1/%d",sum+1/n);
	getch();
}

Output

 
Enter any number: 7
1 + 1/2 + 1/3 + 1/4 + 1/5 + 1/6 + 1/7
Sum = 1/28
c coding problems solutions cC ProgramPrograms

Post navigation

Previous post
Next post

Leave a Reply

Your email address will not be published. Required fields are marked *

The First C Program
Reading Input in a C Program
Compiling C Programs
C Program to read a number and print the factorial
C Program to Print the Sum of N Natural Numbers
C Program to Print Factorial of any Given Number
C Program to Check a Prime Number or Not
C Program to Print the Power of a Given Number
C Program to Print Factors of a Given Number
C Program to Print Factorial using Recursion
C Program to find gross salary
C Program to Reverse a Given Number
C Program to Swap Two Numbers without Using a Third Variable
C Program to Calculate the sum of subjects and find the percentage
C Program to convert temperature from centigrade to Fahrenheit
C Program to find simple interest
C Program to find the area and circumference of a circle
C Program to find the sum of two numbers
C Program to find the sum of two matrices
C Program to find even/odd numbers
C Program to display a matrix
C Program to show the use of the conditional operator
C Program to find the maximum number in an array
C Program to find the greatest of 3 Numbers
C Program to show the sum and average of 10 elements of an array
C Program to print a table of any number
C Program to add two numbers using pointers
C Program to use the bitwise AND operator between the two integers
C Program to display an odd number series and find the sum
C Program to display the sum of the harmonic series
C Program to print the Fibonacci series up to 100
C Program to print a star pattern in a pyramid shape
C Program to print a star pattern in a reverse triangle shape
C Program to print a star pattern in a triangle shape
C Program to display the first 10 natural numbers and their sum
C Program to display arithmetic operations using a switch case
C Program to display weekdays using a switch statement
C Program to find the subtraction of two matrices
C Program to shift input data by two bits to the left
C Program to find occurrences of vowels, consonants, words, spaces and special characters in give sentence
C Program to merge two arrays, excluding the repeating elements
C Program to perform file operations
C Program to find a palindrome number
C Program to find the largest of two numbers using the function
C Program to show call by reference
C Program to show call by value
C Program to show a table of numbers using a function
C Program to find the factorial of a number using a function
C Program to swap two numbers using a function
C Program to find the square of a number using a function
C Program to show input and output of a string
C Program to print the powers of 2 tables for the powers 0 to 20
C Program to find the maximum number in an array using a pointer
C Program to print the multiplication table
C Program to find the transpose of a matrix
C Program to evaluate the equation y=xn
C Program to find the multiplication of two matrices
C Program to display months using enum
C Program for finding the largest number in an array
C Program for sorting the elements of an array in descending order
C Program to count the number of students in each group
C Program to evaluate a square expression and its sum
C Program for plotting of two functions
C Program of minimum cost problem
C Program to draw a histogram
C Program to print a binomial coefficient table
C Program to read a line of text
C Program to illustrate the use of the continue statement
C Program to read a string using the scanf() function
C Program to evaluate the geometric progression series
C Program for production and sales analysis
C Program to illustrate the use of the break statement
C Program to evaluate response to a multiple-choice test
C Program to print the total marks obtained by a student
C Program to calculate standard deviation
C Program to sort a list of numbers and to determine the median
C Program for finding the desired kth smallest element in an array
C Program for removing duplicate elements in an array
C Program to use functions with no arguments and no return values
C Program to sort a customer list in the alphabetical list
C Program for counting characters, words, and lines in a text
C Program to sort a list of names in alphabetical order
C Program to calculate the square and cube by using a function as an argument
C Program to use string handling functions
C Program to return only absolute values
C Program to concatenate a string
C Program to pass arguments to a user-defined function by value/reference
C Program to print the Character and Decimal value of alphabet
C Program to return more than one value from a user-defined function
C Program to count the number of characters copied into a string
C Program to show the use of user defined function
C Program to use global variables on different functions
C Program to use similar variables in different functions
C Program to define & call user-defined functions
C Program to call a user-defined function
C Program to find the power of a value using a function
C Program to use functions with arguments and return values
C Program to use functions with arguments but no return values
C Program to use the ++ operator with the return value of a function
C Program to perform multiplication and division of numbers
C Program to perform addition and subtraction of numbers
C Program to assign the return value of a function to another variable
C Program to call the function through a for loop
C Program to call the user-defined function through the switch() statement
C Program to call the user-defined function through an if statement
C Program to evaluate the function equation s = sqr(a() + b())
C Program to use modulo % with a function
Student marksheet program in C programming

Programmingoneonone

We at Programmingoneonone, also known as Programming101 is a learning hub of programming and other related stuff. We provide free learning tutorials/articles related to programming and other technical stuff to people who are eager to learn about it.

Pages

  • About US
  • Contact US
  • Privacy Policy

Practice

  • Java
  • C++
  • C

Follow US

  • YouTube
  • LinkedIn
  • Facebook
  • Pinterest
  • Instagram
©2026 Programmingoneonone | WordPress Theme by SuperbThemes