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
5347fc53
authored
Nov 05, 2018
by
emonyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
75dd7529
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
92 additions
and
0 deletions
lab9/task1.c
lab9/task1.c
0 → 100644
View file @
5347fc53
#include <stdio.h>
#include <conio.h>
#include <math.h>
int
add
(
int
a
,
int
b
);
int
subt
(
int
c
,
int
d
);
int
mult
(
int
e
,
int
f
);
float
div
(
float
g
,
float
h
);
int
main
()
{
int
x
;
int
y
;
int
sum
;
int
difference
;
int
product
;
float
quotient
;
printf
(
"Enter two integers:"
);
scanf
(
"%d
\n
"
,
&
x
);
scanf
(
"%d"
,
&
y
);
int
choice
;
printf
(
"select a calculation 1 to add, 2 to subtract, 3 to multiply, 4 to divide: "
);
scanf
(
"%d"
,
&
choice
);
switch
(
choice
)
{
case
1
:
sum
=
add
(
x
,
y
);
printf
(
"%d"
,
sum
);
break
;
case
2
:
difference
=
subt
(
x
,
y
);
printf
(
"%d"
,
difference
);
break
;
case
3
:
product
=
mult
(
x
,
y
);
printf
(
"%d"
,
product
);
break
;
case
4
:
quotient
=
div
(
x
,
y
);
printf
(
"%f"
,
quotient
);
break
;
default:
printf
(
"invalid!
\n
out of bounds!! "
);
break
;
}
return
0
;
}
int
add
(
int
a
,
int
b
)
{
int
output
;
output
=
a
+
b
;
return
output
;
}
int
subt
(
int
c
,
int
d
)
{
int
output
;
output
=
c
-
d
;
return
output
;
}
int
mult
(
int
e
,
int
f
)
{
int
output
;
output
=
e
*
f
;
return
output
;
}
float
div
(
float
g
,
float
h
)
{
float
output
;
output
=
g
/
h
;
return
output
;
}
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