Commit e02a02c5 by glkink

Add new file

parent 41e172f4
Showing with 97 additions and 0 deletions
#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;
}
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