1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
guapka [62]
3 years ago
8

Write a program num2rome.cpp that converts a positive integer into the Roman number system. The Roman number system has digits I

1 V 5 X 10 L 50 C 100 D 500 M 1,000 Numbers are formed according to the following rules: a. Only numbers 1 to 3,999 (inclusive) are represented. b. As in the decimal system, the thousands, hundreds, tens, and ones are express separately. c. The numbers 1 to 9 are expressed as I 1 II 2 III 3 IV 4 V 5 VI 6 VII 7 VIII 8 IX 9 As
Computers and Technology
1 answer:
Tom [10]3 years ago
8 0

Answer:

Explanation:

#include <stdio.h>  

int main(void)  

{    

   int num, rem;

   printf("Enter a number: ");

   scanf("%d", &num);

   printf("Roman numerals: ");        

   while(num != 0)

   {

       if (num >= 1000)       // 1000 - m

       {

          printf("m");

          num -= 1000;

       }

       else if (num >= 900)   // 900 -  cm

       {

          printf("cm");

          num -= 900;

       }        

       else if (num >= 500)   // 500 - d

       {            

          printf("d");

          num -= 500;

       }

       else if (num >= 400)   // 400 -  cd

       {

          printf("cd");

          num -= 400;

       }

       else if (num >= 100)   // 100 - c

       {

          printf("c");

          num -= 100;                        

       }

       else if (num >= 90)    // 90 - xc

       {

          printf("xc");

          num -= 90;                                              

       }

       else if (num >= 50)    // 50 - l

       {

          printf("l");

          num -= 50;                                                                      

       }

       else if (num >= 40)    // 40 - xl

       {

          printf("xl");            

          num -= 40;

       }

       else if (num >= 10)    // 10 - x

       {

          printf("x");

          num -= 10;            

       }

       else if (num >= 9)     // 9 - ix

       {

          printf("ix");

          num -= 9;                          

       }

       else if (num >= 5)     // 5 - v

       {

          printf("v");

          num -= 5;                                      

       }

       else if (num >= 4)     // 4 - iv

       {

          printf("iv");

          num -= 4;                                                            

       }

       else if (num >= 1)     // 1 - i

       {

          printf("i");

          num -= 1;                                                                                    

       }

   }

   return 0;

}

You might be interested in
a ------------ insurance policy covers a business during the restoration period after a natural disaster
cricket20 [7]

Answer:

Business Interruption

Explanation:

just took on apex

5 0
3 years ago
Read 2 more answers
What three requirements are defined by the protocols used in network communcations to allow message transmission across a networ
Andru [333]

Answer:

Message encoding, message size and delivery option.

Explanation:

The protocols used in network communications define the details of how a message is transmitted, including requirements for message delivery options, message timing, message encoding, formatting and encapsulation, and message size.

6 0
3 years ago
A hotspot is a location where
Andrej [43]
D is the answer you’re looking for
6 0
3 years ago
Read 2 more answers
By working in a series of positions with increasing responsibilities, the owner of Stonegate Gardens has built her interest in f
Ainat [17]
<span>Spatial Learning Style. Someone who likes to draw or build things probably has a .... Career. The owner of Stonegate Gardens built her interest in flowers and plants into this by working in a series of jobs with increasing responsibilities.</span><span>
</span>
8 0
3 years ago
Read 2 more answers
Suppose we define a WaitlistEntry as follows:
kati45 [8]

Answer:

You have syntax errors, but I don't know if it happened when you posted this question, nevertheless

Explanation:

Correct code:

WaitlistEntry createWL( int iPriority, int iStudentID ) { // Opening Brace

WaitlistEntry w; // Should be ; not ,

w.iPriority = iPriority;   // Assign Missing

w.iStudentID = iStudentID; // Assign Missing

return w;

} // Closing Brace

// Also note: iStudentID this actually has an 'l' which is LD. Not ID, this is why I assume these errors happened when posting the question.

8 0
3 years ago
Other questions:
  • A ________ is a person or an organization that seeks to obtain or alter data or other IS assets illegally, without the owner's p
    9·1 answer
  • How to divert all calls and sms from one mobile phone to other mobile phone, any short code??
    10·1 answer
  • on average, someone with a bachelor’s degree is estimated to earn _______ times more than someone with a high school diploma
    13·1 answer
  • Tables draw your attention to specific information in a spreadsheet. Please select the best answer from the choices provided T F
    10·1 answer
  • Suppose that TCP's current estimated values for the round trip time (estimatedRTT) and deviation in the RTT (DevRTT) are 400 mse
    9·1 answer
  • TRUE OR FALSE!!!!!
    6·2 answers
  • An administrator has noticed that GPO containing new update settings has not yet applied to one of the computers on the network.
    5·1 answer
  • Write a program that prompts the user to enter integers in the range 1 to 50 and counts the occurrences of each integer. The pro
    13·1 answer
  • Fill in the code to complete the following function for computing a Fibonacci number. public static int fib(int index) { if (ind
    6·1 answer
  • What technology would you like to use or see developed that would help you be a "citizen of the world"?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!