Search This Blog

Tuesday 16 July 2019

7. Program to generate n terms of the series 1,-2,6,-24,120.....

//7. Program to generate n terms of the series 1,-2,6,-24,120.....
#include<stdio.h>
void main()
{
    int n=10,i,j=-2,k=1;
    clrscr();
    printf("Enter the limit:");
    scanf("%d",&n);
    printf("The Series is:\n");
    for(i=0;i<n;i++)
    {
           printf("%d\n",k);
           k=k*(j);
           j--;
    }
    getch();
}

No comments :

Post a Comment

FREE Hit Counters