Commit f3727663 by chazog

Add new file

parent 16921572
Showing with 98 additions and 0 deletions
/**
* 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("\nThe program output in Roman notation: ");
for(i = 0; i < Size; i++)
{
if(a[i] >= 0)
{
printf("%d \t ", a[i]);
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment