Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
chazog
/
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
f3727663
authored
Jan 17, 2019
by
chazog
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new file
parent
16921572
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
98 additions
and
0 deletions
finalTest.c
finalTest.c
0 → 100644
View file @
f3727663
/**
* STUDENT: AZOGU CHIBUZO DESMOND
* STUDENT CODE: 182451MVEB
* GROUP: 11
* VARIANT: Dt
**/
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define MAXSIZE 10
void
readNumbers
(
int
a
,
int
array
[
MAXSIZE
]);
void
printNumbers
(
int
a
[],
int
Size
);
void
decToRoman
(
int
num
);
void
displayOutput
(
int
a
,
int
array
[
MAXSIZE
]);
int
main
()
{
int
a
,
Size
,
i
,
num
,
array
[
MAXSIZE
];
while
(
i
<
10
)
{
printf
(
"
\n
Please Enter the Size of an Array : "
);
scanf
(
"%d"
,
&
Size
);
}
readNumbers
(
int
a
,
Size
);
printNumbers
(
int
a
,
Size
);
decToRoman
(
num
);
displayOutput
(
int
a
,
size
);
return
0
;
}
void
readNumbers
(
int
count
,
int
array
[
MAXSIZE
])
{
int
i
;
for
(
i
=
0
;
i
<
count
;
i
++
)
{
do
{
printf
(
"
\n
Please Enter the Array Elements %d: "
,
i
+
1
);
scanf
(
"%d"
,
&
a
[
i
]);
}
while
(
a
[
i
]
<
0
);
}
}
void
printNumbers
(
int
a
[],
int
Size
)
{
int
i
;
printf
(
"
\n
List of Numbers in this Array : "
);
for
(
i
=
0
;
i
<
Size
;
i
++
)
{
if
(
a
[
i
]
>=
0
)
{
printf
(
"%d
\t
"
,
a
[
i
]);
}
}
}
void
decToRoman
(
int
a
)
{
int
val
[]
=
{
1000
,
900
,
500
,
400
,
100
,
90
,
50
,
40
,
10
,
9
,
5
,
4
,
1
};
char
*
symbols
[]
=
{
"M"
,
"CM"
,
"D"
,
"CD"
,
"C"
,
"XC"
,
"L"
,
"XL"
,
"X"
,
"IX"
,
"V"
,
"IV"
,
"I"
};
int
keyCount
,
i
=
0
;
while
(
int
a
[
i
])
{
keyCount
=
a
[
i
]
/
val
[
i
];
while
(
keyCount
--
)
{
printf
(
"%s"
,
symbols
[
i
]);
}
a
[
i
]
%=
val
[
i
];
i
++
;
}
}
void
displayOutput
(
int
a
,
int
array
[
MAXSIZE
])
{
int
i
;
printf
(
"
\n
The program output in Roman notation: "
);
for
(
i
=
0
;
i
<
Size
;
i
++
)
{
if
(
a
[
i
]
>=
0
)
{
printf
(
"%d
\t
"
,
a
[
i
]);
}
}
}
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