ROMAN - yr=yr%50; X=yr/10; yr=yr%10; V=yr/5; I=yr%5; for

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
#include<stdio.h> #include<conio.h> # void ctr (int); void main (void) { int yr; clrscr(); printf("Enter any year less than 10000: "); scanf("%d",&yr); printf("ROMAN equivalent of %d is ",yr); ctr (yr); getch(); } void ctr (int yr) { int a,I,V,X,L,C,D,M; M=yr/1000; yr=yr%1000; D=yr/500; yr=yr%500; C=yr/100; yr=yr%100; L=yr/50;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: yr=yr%50; X=yr/10; yr=yr%10; V=yr/5; I=yr%5; for (a=1;a&lt;=M;a++) printf(&quot;M&quot;); for (a=1;a&lt;=D;a++) printf(&quot;D&quot;); for (a=1;a&lt;=C;a++) printf(&quot;C&quot;); for (a=1;a&lt;=L;a++) printf(&quot;L&quot;); for (a=1;a&lt;=X;a++) printf(&quot;X&quot;); for (a=1;a&lt;=V;a++) printf(&quot;V&quot;); for (a=1;a&lt;=I;a++) printf(&quot;I&quot;); getch(); }...
View Full Document

Ask a homework question - tutors are online