Open bishwobista opened 11 months ago
Can you please assign me this issue, I would like to work on it?
Can you please assign me this issue, I would like to work on it?
Sure @alok5050, go ahead.
Can I have a go at this issue as well? Thanks
Could you assign me this issue as well?
can i please try to solve this issue
// Function to convert an integer to a Roman numeral void intToRoman(int num) { int values[] = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1}; char* numerals[] = {"M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"};
if (num <= 0 || num >= 4000) {
printf("Invalid input. Roman numerals are only defined for values between 1 and 3999.\n");
return;
}
printf("Roman numeral for %d is: ", num);
for (int i = 0; num > 0; i++) {
while (num >= values[i]) {
printf("%s", numerals[i]);
num -= values[i];
}
}
printf("\n");
}
int main() { int num;
printf("Enter an integer: ");
scanf("%d", &num);
intToRoman(num);
return 0;
}
Given an integer, convert it to a roman numeral using C language.