answer.
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
den301095
7 days ago
8

Flowgorithm, Design a program that prompts the user to enter a number within the range of 1 through 10. The program should displ

ay the Roman numeral version of that number. If the number is outside the range of 1 through 10, the program should display an error message?

Computers and Technology
1 answer:
Rzqust [894]7 days ago
6 0
The provided explanation, including the step-by-step code, is as follows: We can approach this issue employing the if elif else model. def main(): # prompts the user to input an integer between 1 to 10 num = int(input('Enter a number in the range of 1 to 10:\n')) # utilizing if elif to display the roman numeral from 1 to 10 if num == 1: print('Roman Numeral for 1 is I') elif num == 2: print('Roman Numeral for 2 is II') elif num == 3: print('Roman Numeral for 3 is III') elif num == 4: print('Roman Numeral for 4 is IV') elif num == 5: print('Roman Numeral for 5 is V') elif num == 6: print('Roman Numeral for 6 is VI') elif num == 7: print('Roman Numeral for 7 is VII') elif num == 8: print('Roman Numeral for 8 is VIII') elif num == 9: print('Roman Numeral for 9 is IX') elif num == 10: print('Roman Numeral for 10 is X') # else to show error message for numbers outside the specified range else: print('Error! Wrong Input') # invoking the main function main() Output: Enter a number in the range of 1 to 10: 6 Roman Numeral for 6 is VI Enter a number in the range of 1 to 10: 15 Error! Wrong Input.
You might be interested in
Which selections are possible for controlling the start time of audio playback? Check all that apply. Automatic Rewind when done
maria [879]

Selecting the option to trim audio upon clicking would be your best answer

5 0
12 days ago
An employee of a large corporation remotely logs into the company using the appropriate username and password. The employee is a
Natasha_Volkova [897]

Respuesta: Te proporcioné 6 opciones de las cuales puedes elegir.

Integridad

Escalabilidad

Calidad de Servicio

Tolerancia a Fallos

Redes de Línea Eléctrica

Seguridad

6 0
1 month ago
python Consider this data sequence: "3 11 5 5 5 2 4 6 6 7 3 -8". Any value that is the same as the immediately preceding value i
oksian1 [797]

int currentNumber,previousNumber = -1, countDuplicates = 0;

do {

cin >> currentNumber;

if ( previousNumber == -1) {

previousNumber = currentNumber;

}else {

if ( previousNumber == currentNumber )

countDuplicates++;

else

previousNumber = currentNumber;

}

} while(currentNumber > 0 );

cout << countDuplicates;

7 0
1 month ago
Input a number [1-50] representing the size of the shape and then a character [x,b,f] which represents the shape i.e. x-&gt;cros
Harlamova29_29 [932]

Response:

C++ code provided below with suitable annotations

Clarification:

pattern.cpp

#include<iostream>

using namespace std;

void printCross(int n)

{

int i,j,k;

if(n%2) //odd number of lines

{

for(int i=n;i>=1;i--)

{

for(int j=n;j>=1;j--)

{

if(j==i || j==(n-i+1))

cout<<j;

else

cout<<" ";

}

cout<<"\n";

}

}

else //even number of lines

{

for(int i=1;i<=n;i++)

{

for(int j=1;j<=n;j++)

{

if(j==i || j==(n-i+1))

{

cout<<" "<<j<<" ";

}

else

cout<<" ";

}

cout<<"\n";

}

}

void printForwardSlash(int n)

{

if(n%2)

{

for(int i=n;i>=1;i--)

{

for(int j=n;j>=1;j--)

{

if(j==n-i+1)

{

cout<<j;

}

else

cout<<" ";

}

cout<<"\n";

}

}

else

{

for(int i=1;i<=n;i++)

{

for(int j=1;j<=n;j++)

{

if(j==(n-i+1))

{

cout<<j;

}

else

cout<<" ";

}

cout<<"\n";

}

}

}

void printBackwardSlash(int n)

{

if(n%2) // odd number of lines

{

for(int i=n;i>=1;i--)

{

for(int j=n;j>=1;j--)

{

if(j==i)

{

cout<<j;

}

else

cout<<" ";

}

cout<<"\n";

}

}

else //even number of lines

{

for(int i=1;i<=n;i++)

{

for(int j=1;j<=n;j++)

{

if(j==i)

{

cout<<j;

}

else

cout<<" ";

}

cout<<"\n";

}

}

}

int main()

{

int num;

char ch;

cout<<"Create a numberes shape that can be sized."<<endl;

cout<<"Input an integer [1,50] and a character [x,b,f]."<<endl;

cin>>num>>ch;

if(ch=='x' || ch=='X')

printCross(num);

else if(ch=='f' || ch=='F')

printForwardSlash(num);

else if(ch=='b' || ch=='B')

printBackwardSlash(num);

else

cout<<"\nWrong input"<<endl;

return 0;

}

4 0
20 days ago
Given a pattern as the first argument and a string of blobs split by | show the number of times the pattern is present in each b
Amiraneli [921]

Response:

The code is provided below

Clarification:

import java.io.BufferedReader;

import java.io.IOException;

import java.io.InputStreamReader;

import java.nio.charset.StandardCharsets;

public class Main {

  /**

  *

  * Process each line of input.

  *

  */

  public static void main(String[] args) throws IOException {

      InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);

      BufferedReader in = new BufferedReader(reader);

      String line;

      while ((line = in.readLine())!= null) {

          String[] splittedInput = line.split(";");

          String pattern = splittedInput[0];

          String blobs = splittedInput[1];

          Main.doSomething(pattern, blobs);

      }

  }

  public static void doSomething(String pattern, String blobs) {

      // Implement your code here. You can create more methods or classes if needed

      int total = 0;

      String arrblobs[] = blobs.split("\\|");

      for (int i = 0; i < arrblobs.length; ++i) {

          int count = 0, index = 0;

          for (;;) {

              int position = arrblobs[i].indexOf(pattern, index);

              if (position < 0)

                  break;

              count++;

              index = position + 1;

          }

          System.out.print(count + "|");

         

          total += count;

      }

      System.out.println(total);

  }

}

5 0
1 month ago
Other questions:
  • When you add a zero to the right of a decimal number, it multiplies its value by 10 (For example, "15" becomes "150"). What simi
    10·1 answer
  • Which of these is an example of the integrity principle that can ensure your data is accurate and untampered with?
    10·2 answers
  • Explain how abstraction is used in a GPS system
    12·2 answers
  • The compare_strings function is supposed to compare just the alphanumeric content of two strings, ignoring upper vs lower case a
    15·1 answer
  • Explain why the cost of ownership may be lower with a cloud database than with a traditional, company database.
    9·1 answer
  • Charlie has a large book collection. He was keeping track of it in a spreadsheet, but it has grown big enough that he wants to c
    10·1 answer
  • PLEASE HELP!!~~
    7·1 answer
  • Modern operating systems decouple a process address space from the machine’s physical memory. List two advantages of this design
    15·1 answer
  • (Java)Write a program that calculates and displays the conversion of an entered number of dollars into currency denominations—20
    11·1 answer
  • What advantage do ExpressCard modules and USB adapters offer over expansion cards?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!