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
Genrish500 [490]
3 years ago
7

Write a program that reads in a list of numbers, and for each number, determines and prints out whether or not that number is ab

undant.
Computers and Technology
1 answer:
adelina 88 [10]3 years ago
7 0
int IsAbundant(int n)
{
int divisorSum = 0;
for (int i = 1; i < n; i++) {
 if ((n % i) == 0) {
  divisorSum += i;
 }
}
return divisorSum > n;
}


int main()
{
int number = 0;
do {
 printf("Enter a number (0 to quit): ");
 scanf_s("%d", &number);
 if (IsAbundant(number)) {
  printf("%d is abundant!\n", number);
   } else
   {
    printf("%d is not abundant.\n", number); }
   } while (number > 0);

   return 0;
}

You might be interested in
a password to a certain database consists of digits that cannot be repeated. if the password is known to consist of at least 8 d
BaLLatris [955]

Answer:

\frac{10!}{2}mins

Explanation:

12 seconds to try one combination will be equivalent to  \frac{1}{12}\times 60 = \frac{1}{5} \ mins

Password contain at least 8 digit i.e. password can contain 8, 9, 10 digit.

Password cannot contain more than 10 digit because it will give room for repetition which it is clearly stated that digit cannot be repeated.

Possible digit that can be used: 9,8,7,6,5,4,3,2,1,0.

Total number of passwords combination possible for each position in 8 digit.

1st position = 10, 2nd position = 9, 3rd position = 8, 4th position = 7, 5th position = 6, 6th position = 5, 7th position = 4, 8th position = 3. Total number of passwords combination possible in 8 digit is equivalent to \frac{10!}{2}.

Total number of passwords combination possible for each position in 9 digit.  

1st position = 10, 2nd position = 9, 3rd position = 8, 4th position = 7, 5th position = 6, 6th position = 5, 7th position = 4, 8th position = 3, 9th position = 2. Total number of passwords combination possible in 9 digit is equivalent to \frac{10!}{1}.

Total number of passwords combination possible for each position in 10 digit.

1st position = 10, 2nd position = 9, 3rd position = 8, 4th position = 7, 5th position = 6, 6th position = 5, 7th position = 4, 8th position = 3, 9th position = 2, 10th position = 1.  Total number of passwords combination possible in 10 digit is equivalent to 10!.

Adding them up and multiplying by  \frac{1}{5} \ mins  to get the total number of time needed to guarantee access to database =  [\frac{10!}{2}\times\ \frac{10!}{1} \times 10!] \frac{1}{5}\ mins = \frac{10!}{2}

7 0
3 years ago
A third party that provides a computer system such as Windows, programming applications, databases, and web servers is demonstra
Lostsunrise [7]

Answer:

Paas

Explanation:

I hope I helped!

6 0
2 years ago
Which block cipher mode of operating requires that both the message sender and receiver access a counter that computes a new val
ankoles [38]

There is block cipher kind of mode of operation. The block cipher mode of operating requires that both the message sender and receiver  is exchanged is the (CTR) Counter.

<h3>What is the Counter (CTR)?</h3>

This is known to be a common block cipher mode of operation. It often needs that both the message sender and receiver to have a kind of access a counter, that helps to computes a new value whenever a ciphertext block is been exchanged.

The disadvantage of CTR is known to be the fact that it needs a synchronous counter necessary for both the sender and receiver.

Learn more about  block cipher mode from

brainly.com/question/9979590

7 0
2 years ago
(1) Output a menu of automotive services and the corresponding cost of each service. (2 pts) Ex: Davy's auto shop services Oil c
Wittaler [7]

Answer:

service1_cost = 0

service2_cost = 0

print("Davy's auto shop services")

print("Oil change -- $35, Tire rotation -- $19, Car wash -- $7, Car wax -- $12")

service1 = input("Select first service: ")

service2 = input("Select second service: ")

if service1 == "Oil change":

   service1_cost = 35

elif service1 == "Tire rotation":

   service1_cost = 19

elif service1 == "Car wash":

   service1_cost = 7

elif service1 == "Car wax":

   service1_cost = 12

elif service1 == "-":

   service1 = "No service"

   service1_cost = 0

if service2 == "Oil change":

   service2_cost = 35

elif service2 == "Tire rotation":

   service2_cost = 19

elif service2 == "Car wash":

   service2_cost = 7

elif service2 == "Car wax":

   service2_cost = 12

elif service2 == "-":

   service2 = "No service"

   service2_cost = 0

print("- - -")

print("Davy's auto shop invoice")

print("Service 1: " + service1 + " costs $" + str(service1_cost))

print("Service 2: " + service2)

print("Total: $" + str(service1_cost + service2_cost))

Explanation:

- Initialize the variables for cost values

- Ask the user for the services

- Depending on the user choice, calculate the cost of each service using if else structure

- Print the chosen services, cost of each service and total cost    

3 0
3 years ago
If an error occurs, each of the numeric functions returns a/an ____________ value.
FrozenT [24]

If an error occurs within a program, each of the numeric functions would return a <u>null value</u>.

<h3>What is a function?</h3>

A function refers to a named portion of a block of executable code that is written to perform a specific task, which is usually a single, related action.

Thus, a function comprises a group of related statements (block of code) that would only run and returns a data when it is called.

In Computer programming, if an error occurs within a program, each of the numeric functions would return a <u>null value</u>.

Read more on a function here: brainly.com/question/19181382

#SPJ12

4 0
2 years ago
Other questions:
  • ​Which SQL keyword is used to search for records?
    8·1 answer
  • Which part of project management involves determining the overall work? Breakdown Incomes Scope Time
    15·1 answer
  • A browser is used for creating Web pages. true or false?
    5·2 answers
  • An attacker tried to hack into the database of a reputed organization. The attacker inserted malicious code into the query of a
    14·1 answer
  • What is the effect of block size in cache design?
    12·1 answer
  • Write a program that keeps track of a simple inventory for a store. While there are still items left in the inventory, ask the u
    12·2 answers
  • What is a Computer ?and it's demerits​
    13·2 answers
  • Why Use LinkedIn AI Automation Tools to Grow Your Sales Pipeline?
    7·1 answer
  • Why is a computer called"a computer"?​
    12·2 answers
  • Draw truth table for the following logic circuit:<br><br> (Please I really need help with this)
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!