Tuesday, March 5, 2024

25. (a²/2!)+(a⁴/4!)+(a⁶/6!)+... :—

25. (a²/2!)+(a⁴/4!)+(a⁶/6!)+... :—


#include<stdio.h>

int main()

{

    int i,n,a,f,k,sum;

    printf("enter value of n and a ");

    scanf("%d%d",&n,&a);

    sum=0,f=1;

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

    {

        k=2*i;

        sum=sum+pow(a,k)/(float)f;

        f=f*(k+1)*(k+2);

    }

    printf("%d",sum);

    return 0;

}


No comments:

Post a Comment