0
Can someone help to write C code in the below question
I do not understand how to write writ C code in the bellow question. Question: List of input and a function is given bellow. Find the list of corresponding output. double input[9]={-4,-3,-2,-1,0,1,2,3,4} double output[9]; The function is f1(x)=1/1+ex(-x).
2 Antworten
0
#include <stdio.h>
#include <math.h>
#define SIZE 9
double f1(double x) {
x = 1/1+exp(-x);
return x;
}
int main() {
int n[SIZE];
for(int i=0; i<SIZE; i++) scanf("%d", &n[i]);
for(int i=0; i<SIZE; i++) printf("%f \n", f1(n[i]));
return 0;
}
// Keep learning & happy coding :D
https://code.sololearn.com/crDUhGpQKz9d
+ 1
Mustaq Mahmud Tafhim instead of
f(x)=1/1+ex(-x)
do you really mean
f(x)=1/(1+exp(-x))
?