Code:
#include<stdio.h> #include<math.h> int main(void) { float x; float k,result,sum; float result2,sum1=0; float x1; int i,n; printf("Please enter a value of x:"); scanf("%f",&x); if(x>0&&x<=2) {result= sum+log10(x); sum=0; printf("%f",result);} else{ printf("Please enter a value that more than 0 and less or equall than 2."); } return 0; }
how to do it? ive tried many times but it always error at the else.
Code:
x1 = (x - 1); for( i = 1; i < n; i++) { k = ( (pow((x-1), (i+1)) )/ (i+1) ); if( ((i+1) % 2) == 0) x1 -= k; else x1 += k; result2=(sum1+x1)/2.303; } printf("%f",result2);
Comment