Tuesday, 30 June 2015

Program 2 : Write a program to print 1+1/2+1/3+1/4+ _ _ +1/N series.

#include <stdio.h>

void main() 

{

    int n,i;

    printf("enter n=");

    scanf("%d", &n);

    printf("1");

    for (i = 2; i <= n; i++) 

    {

        Printf(" + 1 / % d", i);

    }

}

No comments:

Post a Comment