Int fun(int n)// Function for calculating factorial
{
Error if (n & lt0)// parameter is less than 0.
{
Printf ("Error! \ n ");
Exit (0);
}
If(n== 1||n==0) returns1;
other
Returns n * fun (n-1);
}
Master ()
{
int i,sum = 0;
for(I = 1; I<= 10; I++)// Calculate the factorial from 1 to 10 and add it to the sum.
{
sum+= fun(I);
}
Printf ("Result: %d\n", sum);
}