package numerosRomans;
/**
*
* @author Porque
*/
import java.util.Scanner;
public class NumerosRomans {
public static void main
(String[] args
) { Scanner in
= new Scanner
(System.
in); System.
out.
print("Introdueix any(hasta año actual): "); int any= in.nextInt();
int anyActual=2013;
double cambio=0;
while(any>anyActual){
System.
out.
print("Introdueix any correcto: "); any= in.nextInt();
}
int i
=String.
valueOf(any
).
length(); int cola=i;
cambio=any;
while(any!=0){
while(i>=1){
cambio=cambio/10;
i--;
}
System.
out.
print("Numero Romano es:"); i=0;
int dec=1;
int cola3=cola-1;
while(i<=cola-1){
cambio=cambio*10;
int cola2=cola3;
while(cola2-1>=0){
dec=dec*10;
cola2--;
}
cola3--;
int rok=(int)cambio;
cambio=cambio-rok;
rok=rok*dec;
dec=1;
int rotation=0;
System.
out.
println("rok: "+rok
); if(rok>=1000){
rotation=rok/1000;
while(rotation>=1){
rotation--;
}
}
else if(rok==900){
}
else if(rok>=500 && rok<900){
int rotation2=rok/100;
System.
out.
println(rotation2
); while(rotation2>=5){
rotation2--;
}
}
i++;
}
any=0;
}
}
}
cGFja2FnZSBudW1lcm9zUm9tYW5zOwoKLyoqCiAqCiAqIEBhdXRob3IgUG9ycXVlCiAqLwppbXBvcnQgamF2YS51dGlsLlNjYW5uZXI7CnB1YmxpYyBjbGFzcyBOdW1lcm9zUm9tYW5zIHsKICAgIHB1YmxpYyBzdGF0aWMgdm9pZCBtYWluKFN0cmluZ1tdIGFyZ3MpIHsKICAgICAgICBTY2FubmVyIGluID0gbmV3IFNjYW5uZXIgKFN5c3RlbS5pbik7CiAgICAgICAgU3lzdGVtLm91dC5wcmludCgiSW50cm9kdWVpeCBhbnkoaGFzdGEgYcOxbyBhY3R1YWwpOiAiKTsKICAgICAgICBpbnQgYW55PSBpbi5uZXh0SW50KCk7CiAgICAgICAgaW50IGFueUFjdHVhbD0yMDEzOwogICAgICAgIGRvdWJsZSBjYW1iaW89MDsKICAgICAgICB3aGlsZShhbnk+YW55QWN0dWFsKXsKICAgICAgICAgICAgU3lzdGVtLm91dC5wcmludCgiSW50cm9kdWVpeCBhbnkgY29ycmVjdG86ICIpOwogICAgICAgICAgICBhbnk9IGluLm5leHRJbnQoKTsKICAgICAgICB9CiAgICAgICAgaW50IGk9U3RyaW5nLnZhbHVlT2YoYW55KS5sZW5ndGgoKTsKICAgICAgICBpbnQgY29sYT1pOwogICAgICAgIGNhbWJpbz1hbnk7CiAgICAgICAgd2hpbGUoYW55IT0wKXsKICAgICAgICAgICAgd2hpbGUoaT49MSl7CiAgICAgICAgICAgICAgICBjYW1iaW89Y2FtYmlvLzEwOwogICAgICAgICAgICAgICAgaS0tOwogICAgICAgICAgICB9CiAgICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnQoIk51bWVybyBSb21hbm8gZXM6Iik7CiAgICAgICAgICAgIGk9MDsKICAgICAgICAgICAgaW50IGRlYz0xOwogICAgICAgICAgICBpbnQgY29sYTM9Y29sYS0xOwogICAgICAgICAgICB3aGlsZShpPD1jb2xhLTEpewogICAgICAgICAgICAgICAgY2FtYmlvPWNhbWJpbyoxMDsKICAgICAgICAgICAgICAgIGludCBjb2xhMj1jb2xhMzsKICAgICAgICAgICAgICAgIHdoaWxlKGNvbGEyLTE+PTApewogICAgICAgICAgICAgICAgICAgZGVjPWRlYyoxMDsKICAgICAgICAgICAgICAgICAgIGNvbGEyLS07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBjb2xhMy0tOwogICAgICAgICAgICAgICAgaW50IHJvaz0oaW50KWNhbWJpbzsKICAgICAgICAgICAgICAgIGNhbWJpbz1jYW1iaW8tcm9rOwogICAgICAgICAgICAgICAgcm9rPXJvaypkZWM7CiAgICAgICAgICAgICAgICBkZWM9MTsKICAgICAgICAgICAgICAgIGludCByb3RhdGlvbj0wOwogICAgICAgICAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCJyb2s6ICIrcm9rKTsKICAgICAgICAgICAgICAgIGlmKHJvaz49MTAwMCl7CiAgICAgICAgICAgICAgICAgICAgcm90YXRpb249cm9rLzEwMDA7CiAgICAgICAgICAgICAgICAgICAgd2hpbGUocm90YXRpb24+PTEpewogICAgICAgICAgICAgICAgICAgICAgICBTeXN0ZW0ub3V0LnByaW50KCJNIik7CiAgICAgICAgICAgICAgICAgICAgICAgIHJvdGF0aW9uLS07CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZWxzZSBpZihyb2s9PTkwMCl7CiAgICAgICAgICAgICAgICAgICAgU3lzdGVtLm91dC5wcmludCgiQ00iKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGVsc2UgaWYocm9rPj01MDAgJiYgcm9rPDkwMCl7CiAgICAgICAgICAgICAgICAgICAgaW50IHJvdGF0aW9uMj1yb2svMTAwOwogICAgICAgICAgICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbihyb3RhdGlvbjIpOwogICAgICAgICAgICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnQoIkQiKTsKICAgICAgICAgICAgICAgICAgICB3aGlsZShyb3RhdGlvbjI+PTUpewogICAgICAgICAgICAgICAgICAgICAgICBTeXN0ZW0ub3V0LnByaW50KCJDIik7CiAgICAgICAgICAgICAgICAgICAgICAgIHJvdGF0aW9uMi0tOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGkrKzsKICAgICAgICAgICAgfQogICAgICAgICAgICBhbnk9MDsKICAgICAgICAgICAgCiAgICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigpOwogICAgICAgIH0KICAgIH0KfQo=