Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
ilahma
/
iax0583
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
37abe925
authored
6 years ago
by
ilahma
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
f849b8c0
master
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
0 deletions
Homework1/homework1.c
Homework1/homework1.c
0 → 100644
View file @
37abe925
#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
(
sqrt
(
X
*
X
-
4
)
<
0
)
{
printf
(
"y=Complex number
\n
"
);
}
printf
(
"y=%f
\n
"
,
Y
);
}
}
else
{
printf
(
"PLease,enter number between 1 and 15:
\n
"
);
scanf
(
"%d"
,
&
N
);
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
;
}
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment