Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
mahunt
/
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
bd2c0ef2
authored
Oct 14, 2018
by
mahunt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
all
parent
14acc335
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
0 deletions
HW1_182415MVEB_Max_Hunter/HW1_182415MVEB_Max_Hunter.c
HW1_182415MVEB_Max_Hunter/HW1_182415MVEB_Max_Hunter.pdf
HW1_182415MVEB_Max_Hunter/HW1_182415MVEB_Max_Hunter.c
0 → 100644
View file @
bd2c0ef2
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
void
tableMaker
(
int
step
,
int
x
,
float
y
);
// This function is used to make the majority of the table
void
tableMaker
(
int
counter
,
int
x
,
float
y
)
{
printf
(
"nr = %d x = %d y = %lf
\n
"
,
counter
,
x
,
y
);
}
int
main
()
{
// Variables used.
// They are preset for the while loop to prevent incorrect values
int
i
;
int
x
=
1
;
float
end
=
0
;
float
step
=
-
1
;
int
counter
=
1
;
// The while loop is used to prevent the user from entering incorrect values
while
(
end
<
x
||
step
<=
0
)
{
printf
(
"Please enter a starting value: "
);
scanf
(
"%d"
,
&
x
);
printf
(
"Please enter an ending value: "
);
scanf
(
"%f"
,
&
end
);
printf
(
"Please enter step coefficient: "
);
scanf
(
"%f"
,
&
step
);
}
// To change step to an int value for results[]
int
cast
=
step
;
int
cast2
=
end
;
float
results
[(
cast2
/
cast
)
+
1
];
// Array for storing the results
// This loop is for calling the tableMaker function to make the table
for
(
i
=
x
;
i
<=
end
;
i
+=
step
)
// "i" is equal to "x" and added to with "step" while <= "end"
{
// Checks if it is undefined
if
(
i
==
0
||
i
==
360
||
i
==
180
)
// If yes
{
printf
(
"nr = %d x = %d missing
\n
"
,
counter
,
i
);
}
else
// If no
{
results
[
counter
-
1
]
=
((
exp
(
sin
(
i
)))
+
log
(
atan
(
i
)))
/
sin
(
i
);
tableMaker
(
counter
,
i
,
results
[
counter
-
1
]);
counter
++
;
}
}
return
0
;
// End
}
HW1_182415MVEB_Max_Hunter/HW1_182415MVEB_Max_Hunter.pdf
0 → 100644
View file @
bd2c0ef2
File added
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