Professional Documents
Culture Documents
مستند 2
مستند 2
>include <stdio.h#
{ )(int main
;int number,n
;int factorial=1
;scanf("%d",&number)
{ if(number>0)
;printf("factorial :%d\n",factorial)
;return 0
)b
>include<stdio.h#
{)(int main
;int n
;float sum = 0
;float term = 1
;float factorial = 1
;scanf("%d",&n)
;factorial*=m
;term =(m/(factorial))
;sum +=term
;return 0
)c
#include <stdio.h>
int main() {
int n;
float x, expValue = 1.0, term = 1.0;
printf("Enter the value of x: ")
; scanf("%f", &x);
printf("Enter the number of terms for estimating e^x: ");
scanf("%d", &n);
for (int i = 1; i <= n; i++)
{
term *= x / i;
expValue += term;
}
printf("Estimated value of e^x: %.4f\n", expValue);
return 0;
}