#include<stdio.h>
#include<math.h>

int main()
{
    int n,x,fac,sum=1;
    scanf("%d",&x);
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        fac=1;
        for(int j=1;j<=i;j++)
        {
    
        fac=fac*j;
        }
        sum=sum+(pow(-1,i)*pow(x,i))/fac;
    }
    printf("%d",sum);
    
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: