Commit 3d52402a by ilahma

Upload New File

parent ca422b9e
Showing with 55 additions and 0 deletions
#include <stdio.h>
#include <math.h>
int main () {
float A;
float B;
float Y;
float H;
float X;
int N;
int i;
printf("PLease,enter starting value:\n");
scanf("%f",&A);
printf("PLease,enter stopping value:\n");
scanf("%f",&B);
printf("PLease,enter number of steps:\n");
scanf("%d",&N);
if(N>1&&N<15) {
for(i=1;i<=N;i++) {
H=(B-A)/(N-1);
A=A+(i-1)*H;
printf("x=%f\t", X=A);
Y=(4+sqrt(X*X-4))/(5*X*X);
if(5*X*X==0) {
printf("N/A\t");
}
else if ((X*X-4)<0) {
printf("y=Complex number\n");
}
printf("y=%f\n", Y);
}
}
else {
do {
printf("PLease,enter number between 1 and 15:\n");
scanf("%d",&N);
} while(N<1||N>15);
for(i=1;i<=N;i++) {
H=(B-A)/(N-1);
A=A+(i-1)*H;
printf("x=%f\t", X=A);
Y=(4+sqrt(X*X-4))/(5*X*X);
if(5*X*X==0) {
printf("N/A\t");
}
else if (sqrt(X*X-4)<0) {
printf("y=Complex number\n");
}
printf("y=%f\n", Y);
}
}
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment