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

Answers

Answer 1

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;

}


Related Questions

Write a program to input the TotalCost and display the Assured gift as per the following criteria TotalCost(TC) Assured Gift Less than or up to 2000 Wall Clock 32001 to 5000 School Bag 5001 to 10,000 Electric Iron More than 10,000 Wrist Watch​

Answers

Answer:

The program in Python is as follows:

TotalCost = int(input("Total cost: "))

if TotalCost <= 2000:

   print("Wall Clock")

elif TotalCost >= 2001 and TotalCost <= 5000:

   print("School Bag")

elif TotalCost >= 5001 and TotalCost <= 10000:

   print("Electric Iron")

else:

   print("Wrist Watch")

Explanation:

This gets input for total cost

TotalCost = int(input("Total cost: "))

If the total cost is up to 2000, print wall clock as the assured gift

if TotalCost <= 2000:

   print("Wall Clock")

If the total cost is between 2001 and 5000 (inclusive), print school bag as the assured gift

elif TotalCost >= 2001 and TotalCost <= 5000:

   print("School Bag")

If the total cost is between 5001 and 10000 (inclusive), print electric iron as the assured gift

elif TotalCost >= 5001 and TotalCost <= 10000:

   print("Electric Iron")

If the total cost is more than 10000, print wrist watch as the assured gift

else:

   print("Wrist Watch")

describe in detail what each step would look like if you ran into a software error.

Answers

Answer:

First you have to identify the problem.

Second Gather information.

Third iterate through potential solutions.

Fourth Test your solution.

Explanation:

There are many different ways to handle errors in software but this is the way I do it.

Hope this helps :)

After running into a software error, a user needs to first determine the reason for the error, work towards a solution and then execute the solution discovered.

Software Error

A software error occurs when an error or unusual behaviour is observed in a piece of software and which can be reproduced after certain actions are performed that are in line with the stated rules of the software developer. In other words, a software error does not occur if the software was not used as directed by the software developer.

You can learn more about software errors here https://brainly.com/question/18497347

#SPJ6

what is a computer in daily life​

Answers

Answer:

The use of computers on a regular basis in our life is very important. Technically in daily life computer is used to convert raw facts and data into meaningful information and knowledge. Computer science is explored and challenged by humans daily. The computer is like an electronic magical device for our life.

Explanation:

What are the advantages of Radio waves over micro waves?​

Answers

Answer:

radio frequencies can penetrate deeply into the material and thus heat thick products. They heat more slowly than microwaves and thus make it possible to treat more delicate products which require a slower heating.

is computers takes lots of time to do any mathematical calculations.​

Answers

Answer:

I think the answer is a computer take lost of time to do any mathematical calculations because problem in the book or questions.

Hope this helps you ^^

PLEASE HELP DUE!!!
WILL GIVE BRAINLIEST!!

can someone help me please?

Answers

Answer:

see below picture

Explanation:

You can work your way through the formula from the inside out, mapping every operation to a gate.

Abdullah wants to send sessitive data. Abdullah wants to make sure that only ahmed can see and read this. How can abdullah protect this data, so that ahmed can only access it. By using this information make an algorithm.

Answers

Answer:

Use an encryption algorithm

Explanation:

An encryption algorithm can be used to hide the message from parties in-between or any third parties that might want to intercept the message being sent by Abudullah to Ahmed.

Encryption algorithms use cryptographic methods to encrypt or code data such that only the sender and receiver of that data have the keys to properly decode/decrypt these messages/data.

Plz help help help


What was the first electromechanical digital computer?

For your kind information I would like to tell you that don't search on internet because it will show ENIAC and that is not the answer the answeris may be ABC or MARK I. I am just confused, Please help me

Answers

Explanation:

For your kind information the answer of the question is MARK I.

Answer:

What was the first electromechanical digital computer?

=⟩ Mark I was the first electromechanical digital computer.

Hope it helpful to you

how are the computer classified into different types​

Answers

Answer:

Computers differ based on their data processing abilities. They are classified according to purpose, data handling and functionality. ... According to data handling, computers are analog, digital or hybrid. Analog computers work on the principle of measuring, in which the measurements obtained are translated into data.

Define Data communication​

Answers

Explanation:

Data transmission and data reception is the transfer and reception of data over a point-to-point or point-to-multipoint communication channel. Examples of such channels are copper wires, optical fibers, wireless communication channels, storage media and computer buses. 

are the exchange of data between two devices For data communications to occur, the communicating devices must be part of a communication system made up of a combination of hardware

Next, Sue decides to embed a chart from Microsoft Word. She copies and pastes data from a table that she has already created in a Word document. The table includes the results of her paper towel experiment. After reviewing her work, she realizes she needs to update one of the values.
How can she change that value so it is reflected in the chart in her presentation?
She can change the value in the original table in Word.
She can change the value directly on the chart in PowerPoint.
She can change the value using the Current Selection command group.
She can change the value in the mini- spreadsheet for the chart in PowerPoint.

Answers

Answer:

She can change the value in the mini- spreadsheet for the chart in PowerPoint.

Answer:

Answer is D

Explanation:

8. Compare the advantages and disadvantages of using a smartphone rather than a laptop computer for creating a report.​

Answers

Answer: the advantage of using a smartphone rather than a laptop computer is that you can talk to people across the world, call people, make texts, and get easy access to the internet. but the disadvantages are that a lot of people stay inside their house because of phones, not getting enough exercise.

Explanation:

The advantages and disadvantages of using a smartphone rather than a laptop computer for creating a report. have been compared below.

The advantages of using a smartphone rather than a laptop computer are;

Portability; Smartphones are portable enough that they can fit into pockets and some purses and as such can be taken with you anywhere easily unlike a laptop computer that doesn't have such physical property.Cost; Smartphones are largely cheaper than the average laptop computer. Thus, cost is a good factor.

Disadvantages of using a smartphone rather than a laptop computer are;

Screen size; Smartphone screen size are always smaller than that of laptop computers .Software's; Smartphones can't run many of the type of powerful software's that can run on laptop computers.Data entry and user input; Due to the portability of smartphones, their keyboards are usually smaller than that of laptop desktops which makes data entry more difficult for those that have big fingers.

Read more about smartphones and laptops at; https://brainly.com/question/21283135

When you evaluate the use of digital media, how has it affected the newspaper business? The rise of digital media has caused newspaper subscriptions to decline significantly because people are finding their news online. The rise of digital media has had no measurable effect on newspaper subscriptions. The rise of digital media has caused newspaper subscriptions to increase because it has inspired people to care more about news. The rise of digital media has caused newspaper subscriptions to fluctuate depending on the time of year.

Answers

Answer:

The rise of digital media has caused newspaper subscriptions to decline significantly because people are finding their news online.

It is A

Answer:

The rise of digital media has caused newspaper subscriptions to decline significantly because people are finding their news online.

You are in charge of installing a remote access solution for your network. You decide you need a total of four
remote access servers to service all remote clients. Because remote clients might connect to any of the four
servers, you decide that each remote access server must enforce the exact same policies. You anticipate that
the policies will change frequently.
What should you do? (Select two. Each choice is a required part of the solution.)
A. Configure network policies on the RADIUS server.
B. Make each remote access server a member of the RemoteServers group.
C. Configure the exact same network policies on each server.
D. Configure one of the remote access servers as a RADIUS server, and all other servers as RADIUS clients.
E. Use Group Policy to configure network policies in the default Domain Controllers GPO.
F. Configure each remote access server as a domain controller.

Answers

Answer: configure one of the remote access servers as a RADIUS server and all other servers as RADIUS clients

configure network access policies on the RADIUS server

Explanation:

Once the CPU has fetched the data requested, what are the next steps in the process?

A
execute, articulate

B
perform, execute

C
decode, analyze

D
decode, execute

MULTIPLE CHOICE

Answers

Answer:

D. decode execute

Explanation:

a program in matchine language is called​

Answers

Answer:

mcq

Explanation:

machine code is a computer program written in a machine code

Which computer can be used where there is no regular electricity?​

Answers

Answer:

A mechanical computer

Explanation:

Created from gears and levers

(e) Give the output of the following:
String n="Computer Knowledge";
String m = "Computer Applications";
System.out.println(n.substring(0,8).concat(m.substring(9)));​

Answers

Answer:

Computer Applications

true

Answer:

Computer Applications

Explanation:

true

why the internet is not policed​

Answers

Answer:

The Internet allows people to circumvent law by committing criminal acts from areas where their activities are not illegal. Those areas will always exist, and thus new regulations will be just as ineffective as the old ones are ["Net Needs Law Enforcement, Author Says,"]. But Internet traffic is marked with IP addresses, and those addresses can be tied to specific networks with specific locations. Shouldn't it be possible to separate traffic based on the originating network and treat data coming from relatively insecure locations differently than data coming from relatively secure locations? It would be much harder for someone in a rogue nation to hack a network if he had to hack an intermediary network first. And unlike government regulation, which has zero impact in areas where these threats are likely to originate, separating traffic by location might actually work

monitor is hard copy output device??
false
true​

Answers

Answer:

false

Explanation:

monitor is an output device but not hard copy. Hard copy is paper

The CPU is responsible for?

Answers

The CPU (Central Processing Unit) is the part of a computer system that is commonly referred to as the "brains" of a computer. The CPU is also known as the processor or microprocessor. The CPU is responsible for executing a sequence of stored instructions called a program .

Richard needs to copy information from another slide presentation that uses a different design template. To ensure that the information he is copying looks right, which option should he choose?

Answers

Answer:

Yes, you can copy the slides over into a presentation with master slide. Then, right-click each slide, and choose to apply an appropriate template from the master slide

(from vik7336: Hi, I'm not sure about my answer for your question. So I hope this might help)

You are concerned that if a private key is lost, all documents encrypted using your private key will be inaccessible. Which service should you use to solve this problem

Answers

Answer:

Key escrow.

Explanation:

Cyber security can be defined as preventive practice of protecting computers, software programs, electronic devices, networks, servers and data from potential theft, attack, damage, or unauthorized access by using a body of technology, frameworks, processes and network engineers.

In Cyber security, encryption is a form of cryptography and typically involves the process of converting or encoding informations in plaintext into a code, known as a ciphertext.

Typically, an information or data that has been encrypted can only be accessed and deciphered by an authorized user.

Hence, if a private key is lost, all documents encrypted using that private key will be inaccessible to the users. Thus, the service that can be used to solve this problem is a key escrow because the cryptographic (private) keys kept in an escrow system are protected and would not be released to anyone other than the original user (owner).

A key escrow can be defined as a data security method of storing very essential cryptographic keys.

Simply stated, key escrow involves a user entrusting his or her cryptographic key to a third party for storage.

As a standard, each cryptographic key stored or kept in an escrow system are directly linked to the respective users and are encrypted in order to prevent breach, theft or unauthorized access.

Travis just got promoted to network administrator after the previous administrator left rather abruptly. There are three new hires that need onboarding with user accounts. When Travis looks at all the existing account names, he notices there is no common naming system. Where should he look to try to give the new hires user accounts with proper naming conventions

Answers

Answer:

The company's account policy

Explanation:

If there's no common naming system, It's best to go with the company's account policy.

Which of these is NOT an input device?
O keyboard
O mouse
O blinking light
O microphone

Answers

Blinking light is not one of the awansers

this help me please. ​

Answers

Answer:

1) 1011010

2) 1100100

3) 1010101

4) 23

5) 22

6) 24

You notice a growing number of devices, such as environmental control systems and wearable devices, are connecting to your network. These devices, known as smart devices, are sending and receiving data via wireless network connections.
Which of the following labels applies to this growing ecosystem of smart devices?
A. The smartnet
B. Internet of smart devices
C. *Internet of things*
D. Dynamic environment

Answers

Answer:

*Internet of things*

Explanation:

A network with multiple physical smart devices are known as things on the network

You are concerned about attacks directed at your network firewall. You want to be able to identify and be notified of any attacks. In addition, you want the system to take immediate action to stop or prevent the attack, if possible. Which tool should you use

Answers

Answer:

Intrusion Prevention System (IPS)

Explanation:

Firewall can be defined as a network security device that monitors incoming and outgoing network traffic and decides whether to allow or block specific traffic based on a defined set of security rules.

Simply stated, a firewall is a network security protocol that monitors and controls inbound and outbound traffic based on set aside security rules.

A firewall is used to control access to a computer or network, as it creates a barrier between a computer or a network and the internet in order to protect against unauthorized access.

Basically, it is a network security device or security system pre-installed on most computers to essentially inspect data being transmitted to or from a computer

Thus, the tool you should use is an intrusion prevention system (IPS).

Programming languages create codes that represent binary numbers so that programmers can write in a language closer to natural speech.

Answers

Answer:

True

Explanation:

A software can be defined as a set of executable instructions (codes) or collection of data that is used typically to instruct a computer how to perform a specific task and to solve a particular problem.

This ultimately implies that, programming languages are designed and developed for creating codes that represent binary numbers (0s and 1s), so that programmers or software developers can write in a language closer to natural speech i.e the human language.

A logistics company's vulnerability scan identifies the following vulnerabilities on Internet-facing devices in
the DMZ: SQL injection on an infrequently used web server that provides files to vendors SSL/TLS not used for a website that contains promotional information
The scan also shows the following vulnerabilities on internal resources: Microsoft Office Remote Code Execution on test server for a human resources system
TLS downgrade vulnerability on a server in a development network In order of risk, which of the following should be patched FIRST?
A. Microsoft Office Remote Code Execution
B. SQL injection
C. SSL/TLS not used
D. TLS downgrade

Answers

Answer:

A. Microsoft Office Remote Code Execution

Explanation:

From the given options, we have;

The web server having a SQL injection is infrequently use

The information on the website having SSL/TLS not used is promotional

The location of the server having  a TLS downgrade is on a development network

The location of the Microsoft Office Remote Code Execution is on a human resource system test server

Therefore, given that the test server, is the deployment source of the main server, and that with a Remote Code Execution, RCE,  cyber attack, the attacker is able to make commands work on other computers, the RCE attack on the test server is a potential access of an attack on the main servers, and should be patched first.

Other Questions
why is the demand of drinking water increasing in Nepal? why do you think early American read so much work produced in England? Solve for x: -5 < 8x + 11 < 19 Question 2 Evaluate the expression 2(x - 3) + 3y when x = 5 and y = 3. Mark the correct answer. A. 13 B. 15 C. 16D. 25 A pizza parlor has a choice of 10 toppings for its pizzas. From these 10 toppings, how many different 7-topping pizzas are possible? Rita got her dress __(washed wash to wash washing) Quartz, or silicon dioxide (SiO2), is one of the most abundant minerals on Earth. The diagram shows the atomic arrangement of quartz. Based on the diagram, which statement best describes the atomic arrangement of quartz?Group of answer choicesAn extended structure that is made of repeating patterns of atoms.A repeating pattern of small molecules that can move freely past each otherMany different kinds of molecules tha combine to form an extended structure.Many different kinds of atoms that can move freely past each other. what is logical evidence Practice Exercise 3.1 Fill in the blanks: (i) The factors of 12 are (ii) The least non-zero multiples of any number is (iii) ......... is a factor of every number. ing with Numbers Solving for PMT of an annuity) To pay for your child's education, you wish to have accumulated $ at the end of years. To do this you plan on depositing an equal amount into the bank at the end of each year. If the bank is willing to pay percent compounded annually, how much must you deposit each year to reach your goal? Anyone know this??? Help!!!Devise an experiment to test the effect of pH on the activity of biological washing powder the slope of a line on a position vs time graph is thea. velocity b. timec. distance d. displacement 37. The trip between 2 towns is exactly 90 miles. You have gone 40% of this distance. How far haveyou gone? What is the coefficient of the j term in the polynomial negative 8j^ 2 + 7j - 6? write a letter to your friend of sympathy to your friend who has recently got a bike accident and has been hospitalized.plz write a letter in nice way. A math professor is wondering if students today are better or worse than in the past. He has given the same final to this year's class that he gave ten years ago. Compute mean, median, and mode for both classes and write a paragraph summarizing the differences. This Year35456575878069715390999570827393676157747277718183Ten Years Ago56777576597451895579677769916890657969798786989195 What are the types of honey bee? 9/7 = please answer me 1. Find the volume of a rectangular block 15 cm long, 5 cm wide and 10 cm length What is one main objective in the study of economics?RErecognizing the types of services available to everyoneO recognizing the relationship between producers and consumersO recognizing the reasons why consumers supply servicesO recognizing the difference between producers and consumers