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
99399728
authored
Oct 29, 2018
by
matjul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
27177ff3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
92 additions
and
0 deletions
lab9task1.c
lab9task1.c
0 → 100644
View file @
99399728
#include <stdio.h>
int
mult
(
int
x
,
int
y
);
float
div
(
float
x
,
float
y
);
int
add
(
int
x
,
int
y
);
int
sub
(
int
x
,
int
y
);
int
main
(){
int
first
;
int
second
;
int
choice
;
int
result
;
float
resultf
;
puts
(
"Enter the numbers"
);
scanf
(
"%d"
,
&
first
);
scanf
(
"%d"
,
&
second
);
printf
(
"The action with numbers:
\n
1 - mult
\n
2 - div
\n
3 - add
\n
4 - subs
\n
"
);
do
{
puts
(
"pick the numbers"
);
scanf
(
"%d"
,
&
choice
);
}
while
(
choice
<
1
||
choice
>
4
);
switch
(
choice
){
case
1
:
puts
(
"multiplication"
);
result
=
mult
(
first
,
second
);
printf
(
"%d"
,
result
);
break
;
case
2
:
puts
(
"division"
);
resultf
=
div
(
first
,
second
);
printf
(
"%f"
,
resultf
);
break
;
case
3
:
puts
(
"adding"
);
result
=
add
(
first
,
second
);
printf
(
"%d"
,
result
);
break
;
case
4
:
puts
(
"substracting"
);
result
=
sub
(
first
,
second
);
printf
(
"%d"
,
result
);
break
;
}
return
0
;
}
int
mult
(
int
x
,
int
y
){
int
A
;
A
=
x
*
y
;
return
A
;
}
float
div
(
float
x
,
float
y
){
float
B
;
B
=
x
/
y
;
return
B
;
}
int
add
(
int
x
,
int
y
){
int
C
;
C
=
x
+
y
;
return
C
;
}
int
sub
(
int
x
,
int
y
){
int
D
;
D
=
x
-
y
;
return
D
;
}
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