Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
glkink
/
C-programming
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
e02a02c5
authored
Jan 23, 2022
by
glkink
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new file
parent
41e172f4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
97 additions
and
0 deletions
täisarvroomaks
täisarvroomaks
0 → 100644
View file @
e02a02c5
#include <stdio.h>
#include <stdio.h>
int main(void)
{
int number;
printf("Sisesta taisarv: ");
scanf("%d", &number);
printf("\nSisestatud taisarv Rooma numbrina: ");
while(number != 0)
{
if (number >= 1000) // 1000 - m
{
printf("M");
number -= 1000;
}
else if (number >= 900) // 900 - cm
{
printf("CM");
number -= 900;
}
else if (number >= 500) // 500 - d
{
printf("D");
number -= 500;
}
else if (number >= 400) // 400 - cd
{
printf("CD");
number -= 400;
}
else if (number >= 100) // 100 - c
{
printf("C");
number -= 100;
}
else if (number >= 90) // 90 - xc
{
printf("XC");
number -= 90;
}
else if (number >= 50) // 50 - l
{
printf("L");
number -= 50;
}
else if (number >= 40) // 40 - xl
{
printf("XL");
number -= 40;
}
else if (number >= 10) // 10 - x
{
printf("X");
number -= 10;
}
else if (number >= 9) // 9 - ix
{
printf("IX");
number -= 9;
}
else if (number >= 5) // 5 - v
{
printf("V");
number -= 5;
}
else if (number >= 4) // 4 - iv
{
printf("IV");
number -= 4;
}
else if (number >= 1) // 1 - i
{
printf("I");
number -= 1;
}
}
printf("\n");
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