HI can anyone help me to write this programe in c
Q ; WRITE A PROGRAM TO DETERMINE AND PRINT THE SUM OF THE FOLLOWING HARMONIC SERIES FOR A GIVEN VALUE OF N;
1+1/2+1/3+14+....................1/N
THE VALUE SHOULD BE GIVEN INTERACTIVELY THROUGH THE TERMINAL

Recommended Answers

All 4 Replies

1+2+3+4+5+6+7...

n(n+1)/2

10(10+1)/2 this will add 1+2+3+4+5....10

you can modify that equation.

can you please help me by elaborating this.i mean with full program

hi..

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

void main()
{
	int n,i;
	clrscr();
	printf("Enter N:- ");
	scanf("%d",&n);
	for(i=1;i<n;i++)
	{
		printf("1/%d  +  ",i);
	}
	printf("1/%d",i);
	getch();
}

you can only print this series..
but if you want series with answer..
than you just have to add one equation in loop.. sum=sum+(1/i); at last print this sum...
okay

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.