Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
emonyi
/
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
967d8fd2
authored
Dec 01, 2018
by
emonyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
9a1beebd
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
0 deletions
Homework1/Homework1Ccode.c
Homework1/Homework1Ccode.c
0 → 100644
View file @
967d8fd2
/**
* File: Homework1.c
* Author: ONYIA Emmanuel Chinedu
* created: 12.10.2018
* Last edit: 20.10.2018
*
* Description:
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define LIMIT 15
int
main
(
void
)
{
//initialization of variables
float
A
=
0
;
int
i
=
0
;
int
N
=
0
;
float
H
=
0
;
float
x
;
double
y
;
//User enters values
//do-while statement ensuring user input A > 0; H > 0
do
{
printf
(
"Enter the starting value A for arguments: "
);
scanf
(
"%f"
,
&
A
);
if
(
A
<=
0
)
{
printf
(
"
\n
The starting value must be Greater than 0
\n\n
"
);
}
}
while
(
A
<=
0
);
do
{
printf
(
"Enter the step value H for arguments: "
);
scanf
(
"%f"
,
&
H
);
}
while
(
H
<=
0
);
printf
(
"
\n
s/n
\t
Arguments (X)
\t
Function(Y)
\n
"
);
x
=
A
;
//for loop for number of prints limit 15
for
(
N
=
0
;
N
<
LIMIT
;
N
++
)
{
//mathematical equation
x
+=
i
*
(
H
);
y
=
(
pow
(
sin
(
x
+
5
),
2
)
+
cos
(
x
))
/
(
x
+
exp
(
x
+
3
));
//output print statement
printf
(
" %d
\t
%0.2f
\t\t
%0.25f
\n
"
,
N
+
1
,
x
,
y
);
i
++
;
}
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