Tuesday, March 5, 2024

17. 1!+2!+3!+...n :—

17. 1!+2!+3!+...n :—


#include<stdio.h>

int main()

{

    int i,f,n,sum;

    printf("enter a value of n ");

    scanf("%d",&n);

    sum=0,f=1;

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

    {

        f=f*i;

        sum=sum+f;

    }

    printf("%d",sum);

    return 0;

}


No comments:

Post a Comment