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
eb59b87c
authored
Oct 16, 2018
by
matjul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
df431ff2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
0 deletions
homework1.c
homework1.c
0 → 100644
View file @
eb59b87c
#include <stdio.h>
#include <math.h>
int
main
(){
float
x
;
float
y
;
int
i
;
int
startV
;
//starting value of x
int
stopV
;
//stopping value
int
stepV
;
//a step value
int
stepN
;
//number of steps
printf
(
"Insert a starting value: "
);
scanf
(
"%d"
,
&
startV
);
printf
(
"Insert a stoping value: "
);
scanf
(
"%d"
,
&
stopV
);
printf
(
"Insert a step: "
);
do
{
scanf
(
"%d"
,
&
stepV
);
if
(
stepV
<
0
){
printf
(
"Step must be positive: "
);
}
}
while
(
stepV
<
0
);
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 equal to 15: "
);
}
}
while
(
stepN
<
0
||
stepN
>
15
);
printf
(
"x
\t
"
);
printf
(
"y
\n
"
);
for
(
i
=
0
;
i
<
stepN
;
i
++
){
for
(
x
=
startV
+
(
i
*
stepV
);
x
<=
startV
+
(
i
*
stepV
);
x
++
){
if
(
x
<=
stopV
){
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
;
}
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