I am having a problem with this project I am working on. The assignment is to create an application that will give a user the choice of displaying the roman numeral equivalence of a number between 1 and 10 or displaying a count of roman numerals from 1 to 10.
program should not end before the user decides to end it
must use the if, while, for and switch structures in code
and output format should resemble:
"This program can display any roman # between 1 and 10.
This program can also count from 1 to 10 in roman #
enter the # 1 to display the roman equivalent of a number
enter #2 to count from 1 to 10 in roman numerals
enter any other # to end application
enter ur choice.... 1
enter any # from 1 to 10: 7
roman numeral VII Decimal 7
and it should loop back to enter 1 or 2 options
than enter ur choice 2
it should list roman numeral I-X and decimal 1-10 but in 2 separate rows.
This is what i have so far but I'm stuck. My first if statement keeps looping and i just cant think of what i should do for the second part. Help would be greatly appreciated.
#include <stdio.h>
int main( void )
{
int choice;
int num;
printf("This program can display any Roman numeral between 1 and 10.\n");
printf("This program can also count from 1 to 10 in Roman numeral.\n\n");
printf("Enter the number 1 to display the Roman equivelent of a number.\n");
printf("Enter the number 2 to count from 1 to 10 in Roman numerals.\n");
printf("Enter any other number to end the application.\n\n");
printf("Enter your choice.\n");
scanf("%d\n", &choice);
while ( choice == 1 || choice == 2 )
if ( choice == 1 ){
printf( "enter any number from 1 to 10\n" );
scanf( "%d\n", &num );
switch ( num ){
case '1':
printf( "%s%s\n", "Roman\n Numeral", "Decimal");
printf( "%s\n" , "I" );
break;
case '2':
printf( "%s%s\n", "Roman\n Numeral", "Decimal");
printf( "%s\n" , "II" );
break;
case '3':
printf( "%s%s\n", "Roman\n Numeral", "Decimal");
printf( "%s\n" , "III" );
break;
case '4':
printf( "%s%s\n", "Roman\n Numeral", "Decimal");
printf( "%s\n" , "IV" );
break;
case '5':
printf( "%s%s\n", "Roman\n Numeral", "Decimal");
printf( "%s\n" , "V" );
break;
case '6':
printf( "%s%s\n", "Roman\n Numeral", "Decimal");
printf( "%s\n" , "VI" );
break;
case '7':
printf( "%s%s\n", "Roman\n Numeral", "Decimal");
printf( "%s\n" , "VII" );
break;
case '8':
printf( "%s%s\n", "Roman\n Numeral", "Decimal");
printf( "%s\n" , "VIII" );
break;
case '9':
printf( "%s%s\n", "Roman\n Numeral", "Decimal");
printf( "%s\n" , "IX" );
break;
case '10':
printf( "%s%s\n", "Roman\n Numeral", "Decimal");
printf( "%s\n" , "X" );
break;
}
}
if ( choice == 2 )
for ( num = 1; num <= 10; num++)
printf( "%s%s\n", "Roman\n Numeral", "Decimal");
return 0;
}