int n;
printf(“Enter your number:”);
scanf(“%d”, &n);
long f =1;
for (int i =1; i<=n; i++)
f *= i;
cout <<“Factorial is” << f);
}
}
OUTPUT (after running):
Enter your number:
4
Factorial is 24
Q4.
An important series in mathematics is the sine series. Write a C program to find the value of
sin(x) from the following series:
Sin(x) = x –x
3
/ 3! + x
5
/ 5! –x
7
Do'stlaringiz bilan baham: