Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
matjul
/
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
3dd5a3a0
authored
6 years ago
by
matjul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
4ac636d0
master
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
0 deletions
homework1fixed.c
homework1fixed.c
0 → 100644
View file @
3dd5a3a0
#include <stdio.h>
#include <math.h>
int
main
()
{
float
x
;
float
y
;
int
i
;
float
startV
;
//starting value of x
float
stopV
;
//stopping value
float
stepV
;
//a value of step that is calculated afer all inputs
int
stepN
;
//number of steps
printf
(
"Insert a starting value: "
);
scanf
(
"%f"
,
&
startV
);
printf
(
"Insert a stoping value: "
);
scanf
(
"%f"
,
&
stopV
);
printf
(
"Insert a number of steps: "
);
do
{
scanf
(
"%d"
,
&
stepN
);
if
(
stepN
<
0
){
printf
(
"Number of steps must be positive: "
);
}
if
(
stepN
>
15
){
printf
(
"Number of steps must be less or equals to 15: "
);
}
}
while
(
stepN
<
0
||
stepN
>
15
);
printf
(
"x
\t
"
);
printf
(
"y
\n
"
);
stepV
=
(
stopV
-
startV
)
/
(
stepN
-
1
);
for
(
i
=
0
;
i
<
stepN
;
i
++
){
for
(
x
=
(
stepV
*
i
)
+
startV
;
x
<=
(
stepV
*
i
)
+
startV
;
x
++
){
if
(
4
-
pow
(
x
,
2
)
==
0
){
printf
(
"%f
\t
not defined
\n
"
,
x
);
}
else
{
y
=
(
sqrt
(
pow
(
x
,
3
)
+
(
4
*
pow
(
x
,
2
)))
/
(
4
-
(
pow
(
x
,
2
))));
printf
(
"%f
\t
%f
\n
"
,
x
,
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