Title Converting Roman letter to number Author: Divakaran Dhanasekaran Visitor Submitted Source Code Author Email: divak_n@hotmail.com Description: This program converts the roman letter to number of upto 1000. Hits: 2812 Since 25th November, 2003 Code: Select and Copy the Code #include<stdio.h> #include<conio.h> #include<string.h> #include<stdlib.h> void main() { clrscr(); int *a,l,i,j,k; char *s; printf("Enter The Roman Number\n"); scanf("%s",s); l=strlen(s); for(i=0;i<l;i++) { if(s[i]=='I') a[i]=1; else if(s[i]=='V') a[i]=5; else if(s[i]=='X') a[i]=10; else if(s[i]=='L') a[i]=50; else if(s[i]=='C') a[i]=100; else if(s[i]=='D') a[i]=500; else if(s[i]=='M') a[i]=1000; else { printf("Wrong Input"); getch(); exit(0); } } k=a[l-1]; for(i=l-1;i>0;i--) { if(a[i]>a[i-1]) k=k-a[i-1]; else if(a[i]==a[i-1] || a[i]<a[i-1]) k=k+a[i-1]; } printf("\n%d",k); getch(); }