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
Vlad [161]
3 years ago
6

Connect 5 LEDs with any random colors. Iteratively, turn ON 1 to 5 LED(s) that will take 5 iterations in total, and in every ite

ration ask the user "How many LEDs are ON?". At the end of the completion of all iterations, display in the output "Correct answers: a%". For example, if a user’s answers are correct to none of the 5 questions, then display "Correct answers: 0%"; If a user’s answers are correct to 1 question, then display "Correct answers: 20%"; If a user’s answers are correct to 2 questions, then display "Correct answers: 40%"; and so on.

Computers and Technology
1 answer:
vlabodo [156]3 years ago
7 0

Answer:

See explaination for program code.

Explanation:

C++ programming language is a powerful general-purpose programming language. It can be used to develop operating systems, browsers, games, and so on.

C++ supports different ways of programming like procedural, object-oriented, functional, and so on. This makes C++ powerful as well as flexible.

Please kindly refer to attachment for a C++ programming code that performs the operation.

You might be interested in
Some financial institutions can be really bad about putting unexpected charges
kherson [118]
I think it’s false ............
7 0
3 years ago
) Perform error checking for the data point entries. If any of the following errors occurs, output the appropriate error message
emmainna [20.7K]

Answer:

In Python:

entry = input("Sentence: ")

while True:

   if entry.count(",") == 0:

       print("Error: No comma in string")

       entry = input("Sentence: ")

   elif entry.count(",") > 1:

       print("Error: Too many comma in input")

       entry = input("Sentence: ")

   else:

       ind = entry.index(',')+1

       if entry[ind].isnumeric() == False:

           print("Comma not followed by an integer")

           entry = input("Sentence: ")

       else:

           break

print("Valid Input")

Explanation:

This prompts the user for a sentence

entry = input("Sentence: ")

The following loop is repeated until the user enters a valid entry

while True:

This is executed if the number of commas is 0

<em>    if entry.count(",") == 0:</em>

<em>        print("Error: No comma in string")</em>

<em>        entry = input("Sentence: ")</em>

This is executed if the number of commas is more than 1

<em>    elif entry.count(",") > 1:</em>

<em>        print("Error: Too many comma in input")</em>

<em>        entry = input("Sentence: ")</em>

This is executed if the number of commas is 1

   else:

This calculates the next index after the comma

       ind = entry.index(',')+1

This checks if the character after the comma is a number

       if entry[ind].isnumeric() == False:

If it is not a number, the print statement is executed

<em>            print("Comma not followed by an integer")</em>

<em>            entry = input("Sentence: ")</em>

If otherwise, the loop is exited

<em>        else:</em>

<em>            break</em>

This prints valid input, when the user enters a valid string

print("Valid Input")

Note that: entry = input("Sentence: ") <em>is used to get input</em>

4 0
3 years ago
You write a short story, but you want to make sure your work is protected before you post it online. What should you do to help
Mars2501 [29]
Make sure you but no copyright, author, and date of publication, that may help.
8 0
3 years ago
Describe PROM, EPROM and EEPROM memories​
skelet666 [1.2K]

Answer:

Explanation:

PROM is a Read Only Memory (ROM) that can be modified only once by a user while EPROM is a programmable ROM that can be erased and reused. EEPROM, on the other hand, is a user-modifiable ROM that can be erased and reprogrammed repeatedly through a normal electrical voltage.

7 0
3 years ago
a. displays the sum of all even numbers between 2 and 100 (inclusive). b. displays the sum of all squares between 1 and 100 (inc
LuckyWell [14K]

Answer:

The program required is in the explanation segment.

Explanation:

Program :

import math

# a. displays the sum of all even numbers between 2 and 100 (inclusive).

print("All even numbers from 2 to 100 inclusive ")

sum=0

i=2

while i<=100:

if i %2 ==0:

sum=sum+i

print(i,end=" ")

i=i+1

print("\nThe sum of all even numbers between 2 and 100 (inclusive) :",sum);

#b. displays the sum of all squares between 1 and 100 (inclusive).

print("\nAll squares numbers from 1 to 100 inclusive:")

i=1

sum=0

while i<=100:

print(i*i,end=" ")

i=i+1

sum=sum+(i*i)

print("\n\nThe sum of all squares between 1 and 100 (inclusive) is :",sum)

#c. displays the powers of 2 from 1 up to 256.

print("\nAll powers of 2 from 2 ** 0 to 2 ** 8:")

i=0

while True:

p=math.pow(2,i)

if p>256:

break

print("2 ** ",i," is ",int(p))

i=i+1

#d. displays the sum of all odd numbers between a and b (inclusive), where a and b are inputs

print("\nCompute the sum of all odd integers between two intgers ")

a=int(input("Enter an integer:"))

b=int(input("Enter another integer: "))

count = 0

temp=a

sum=0

while a<=b:

if a%2!=0:

print(a,end=" ")

sum=sum+a

a=a+1

print("\nThe total of the odd numbers from ", temp ," to ", b ,"is",sum)

#e.displays the sum of all odd digits of an input. (For example, if the input is 32677, the sum would be 3 + 7 + 7 = 17.)

print("\nCompute the sum of the odd digits in an integer ")

n=int(input("Enter an integer:"))

count=0

sum=0

temp=n

while n!=0:

rem = n%10

if rem%2!=0:

sum=sum+rem

count=count+1

n=int(n/10)

print("Sum of the odd digits is ",sum)

print("The total of the odd digits in ",temp," is ",count)

4 0
3 years ago
Other questions:
  • Which of the four basic functions of a computer refers to the collection of data by a computer?
    11·2 answers
  • If a*b = 2a - 56, calculate the value of<br>3 * 4​
    14·1 answer
  • Write a program that reads raw data from a file that contains an inventory of items. The items should be sorted by name, and the
    12·1 answer
  • To access your gradebook you click on the __________.
    6·2 answers
  • Integer indexing array: Weekend box office The row array movieBoxOffice stores the amount of money a movie makes (in millions of
    11·1 answer
  • Your computer is taking longer than usual to open files and you notice that your hard drive light stays on longer than usual whi
    9·1 answer
  • Add me on Fortnite. Epic is smashman892. *Ik it sux but it's an old account* Comment ur epic
    6·2 answers
  • Five plus six is equal to?​
    10·2 answers
  • Array bounds checking should be directly coded into a system rather than assumed.
    12·1 answer
  • 48
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!