*/
Got something to write about? Check out our Article Builder.
*/

View \ROMAN.C

Convert Roman numbers to/from Arabic, w/C src

Submitted By: Unknown
Rating: starstarstarstar (Rate It)


/* roman.c

   Converts an Arabic number to its Roman equivalent

   David S McMeans    Not copyrighted April 1993
   [[Email Removed]]

*/


#include <stdio.h>
#include <stdlib.h>
#include <string.h>


main( argc, argv )
int argc;
char **argv;
{
  char buf[80];
  unsigned long int i,j;
  extern char *Roman_1000;

  Roman_1000 = "G";

  if (argc < 2)
  {
    printf("Usage: %s <arabic number>\n", argv[0] );
    exit( 1 );
  }
  i = (unsigned long int )atol( argv[1] );

  printf( " Arabic %lu    Roman: %s\n", i, Arabic2Roman( i, buf ));
#if 0
  for (j=1; j <= i; j++)
    printf("%d %s\n", j, Arabic2Roman( j, buf ));
#endif
}

corner
© 1996-2008 CommunityHeaven LLC. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
North American business development: Nicolai Wadstrom. Publisher: Lars Hagelin.