I should get like this
f(0)= 1
f(1)=1
f(2)=1
f(3)=1
f(4)=1
f(5)=1
I have done the programming for f(0). Can you tell me how to insert loop here?
Code:
#include <stdio.h>
#include <math.h>
#define PI 3.14159265
int t;
double cos(double x);
int main(int argc, const char * argv[])
{
double x, ret1, val, val1;
int roundret1;
t = 0;
/* first exponential*/
/*define variables*/
double value;
double result;
/* Assign the value we will find the exp of */
value = -5;
/* Calculate the exponential of the value */
result = exp(value);
/* Display the result of the calculation */
printf("The Exponential of %f is %f\n", value, result);
/*second exponential*/
/*defining variables*/
double value1;
double ret;
double result1;
int tempCheck, tempret1;
val = PI / 180.0;
ret = cos( t*val );
printf("The ret is %f\n", ret);
ret1 = cos(ret*val );
printf("The ret1 is %f\n", ret1);
/*rounding the ret1*/
if(ret1>0)
{
tempret1 = ret1*10;
tempCheck = tempret1%10;
if(tempCheck>=5)
{
roundret1 = ret1;
roundret1++;
}
else
{
roundret1 = ret1;
}
printf("The roundret1 is %d\n", roundret1);
}
/* Assign the value we will find the exp of */
value1 = -5*roundret1;
printf("The value1 is %f\n", value1);
/* Calculate the exponential of the value */
result1 = exp(value1);
/* Display the result of the calculation */
printf("The Exponential of %f is %f\n", value1, result1);
/* Third exponential*/
/*defining variables*/
double value2, result2;
value2 = 10;
result2 = exp(value2);
/* Display the result of the calculation */
printf("The Exponential of %f is %f\n", value2, result2);
/* fourth exponential*/
/*defining variables*/
double ret2, ret3, value3, result3;
ret2 = sin(t*val);
ret3 = sin(ret2);
value3 = -5*ret3;
printf("The value1 is %f\n", value2);
/* Calculate the exponential of the value */
result3 = exp(value3);
/* Display the result of the calculation */
printf("The Exponential of %f is %f\n", value3, result3);
/*multiplying 4 exponentials*/
double F;
F=result*result1*result2*result3;
printf("The final value of F when t=0 is %f\n", F);
return 0;
}