#include <stdio.h>
#include <conio.h>
void main()
{
int yr;
clrscr();
printf ("ENTER ANY YEAR :");
scanf ("%d",&yr);
yr = roman (yr,1000,"m");
yr = roman (yr,500,"d");
yr = roman (yr,100,"c");
yr = roman (yr,50,"l");
yr = roman (yr,10,"x");
yr = roman (yr,9,"ix");
yr = roman (yr,5,"v");
yr = roman (yr,4,"iv");
yr = roman (yr,1,"i");
getch();
}
roman (int yr, int n, char *ch)
{
int t,i;
t = yr/n;
for (i = 1; i <= t; i++)
printf ("%s",ch);
return(yr-t*n);
}
#include <conio.h>
void main()
{
int yr;
clrscr();
printf ("ENTER ANY YEAR :");
scanf ("%d",&yr);
yr = roman (yr,1000,"m");
yr = roman (yr,500,"d");
yr = roman (yr,100,"c");
yr = roman (yr,50,"l");
yr = roman (yr,10,"x");
yr = roman (yr,9,"ix");
yr = roman (yr,5,"v");
yr = roman (yr,4,"iv");
yr = roman (yr,1,"i");
getch();
}
roman (int yr, int n, char *ch)
{
int t,i;
t = yr/n;
for (i = 1; i <= t; i++)
printf ("%s",ch);
return(yr-t*n);
}
0 comments :
Post a Comment