ROMAN - yr=yrP X=yr/10 yr=yr V=yr/5 I=yr%5...

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<=M;a++) printf("M"); for (a=1;a<=D;a++) printf("D"); for (a=1;a<=C;a++) printf("C"); for (a=1;a<=L;a++) printf("L"); for (a=1;a<=X;a++) printf("X"); for (a=1;a<=V;a++) printf("V"); for (a=1;a<=I;a++) printf("I"); getch(); }...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online