I am trying to get the value of "w" but when I do the For loop ,it only gives me 4 results:
Problem:
https://imgur.com/a/F9wPKF7
Code:
#include <stdio.h>
#include <math.h>
int main() {
int x,e,w;
float a = 2.5;
for (x=1; x<6; x++) {
if (x>a) {
w = x*cbrt(x-a);
}
else if (x=a) {
w = x*sin(a*x);
}
else if (x<a) {
w = pow(e,(-a*x))*cos(a*x);
}
printf("%d ",x);
}
return 0;
}
Output:
2 3 4 5
I know in this program i dont search for the value of w but I wanted to see why does it give me only 4 number instead of 5? why is the one missing and ow can I solve it? Thank you
>Solution :
else if (x=a) should beelse if (x==a)