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
Inessa05 [86]
2 years ago
14

Two numbers are given (numbers are entered from the keyboard). If both numbers are positive, then output their sum, if both numb

ers are negative, then output their product, if the numbers are positive and negative, then output the square of a positive number (number ** 2).
Даны два числа (числа вводим с клавиатуры). Если оба числа положительные, то выдать их сумму, если оба числа отрицательные, то выдать их произведение, если числа положительное и отрицательное, то выдать квадрат положительного числа (number**2).
Computers and Technology
1 answer:
AleksAgata [21]2 years ago
3 0

Answer:

The program in Python is as follows:

num1 = int(input())

num2 = int(input())

if num1 >=0 and num2 >= 0:

   print(num1+num2)

elif num1 <0 and num2 < 0:

   print(num1*num2)

else:

   if num1>=0:

       print(num1**2)

   else:

       print(num2**2)

Explanation:

This gets input for both numbers

num1 = int(input())

num2 = int(input())

If both are positive, the sum is calculated and printed

<em>if num1 >=0 and num2 >= 0:</em>

<em>    print(num1+num2)</em>

If both are negative, the products is calculated and printed

<em>elif num1 <0 and num2 < 0:</em>

<em>    print(num1*num2)</em>

If only one of them is positive

else:

Calculate and print the square of num1 if positive

<em>    if num1>=0:</em>

<em>        print(num1**2)</em>

Calculate and print the square of num2 if positive

<em>    else:</em>

<em>        print(num2**2)</em>

You might be interested in
MOA115 Medical Records and Insurance
Kay [80]

Based on the information given about the insurance, it should be noted that there's a difference between the covered and charged amount.

<h3>What is an insurance?</h3>

From the complete question, an insurance means a policy where an individual is entitled to financial protection.

In this case, there's a difference between the covered andd charged amount. Also, based on the table, the amount that Yan will be responsible for is 12.17.

Learn more about insurance on:

brainly.com/question/25855858

6 0
1 year ago
The superclass Calculator contains: a protected double instance variable, accumulator, that contains the current value of the ca
yawa3891 [41]

Answer:

The following program are written in JAVA Programming Language.

//inherit the Calculator class

public class CalculatorWithMemory extends Calculator {  

   private double memory = 0.0;    //initialize double type variable

   public void save() {   //define function

       memory = accumulator;    

   }

   public void recall() {   //define function

       accumulator = memory;

   }

   public void clearMemory() {   //define function

       memory = 0;     //initialize the value

   }

   public double getMemory() {  

       return memory;    // return the value in "memory" variable

   }

}

Explanation:

Here, we inherit the property of the "Calculator" class.

Then, we define the private double type variable "memory" and assign value 0.0.

Then we set the function "save()" inside it we assign the value of "memory" in "accumulator" and close the function.

Then, we define the function "recall()" inside it we assign the value of "accumulator" in "memory" and close the function.

Then we set the function "clearMemory()" inside it we assign "memory" to 0.

After all, we set the double type function "getMemory()" inside we return the value of the "memory".

7 0
3 years ago
This is your code.
lubasha [3.4K]

Answer:

35

Explanation:

We will be going inside B array, because he was in second place in array E,and will be the first element of array B, so it's 35

E can be understanded as:

E=[[21, 'dog', 'red'],[35, 'cat', 'blue'],[12, 'fish', 'green']], so, you can see array E as array of arrays or so-called two-dimensional array

6 0
2 years ago
Who create and developed castlevania?
Ray Of Light [21]
The game was made by Nintendo. 
Developers: Koji Igarashi<span> </span>Hideo Kojima<span> </span>Michiru Yamane<span> </span><span>Yuzo Koshiro. </span>
6 0
3 years ago
Write a sentence that describes how a series circuit works.
Lorico [155]

Answer:

In a series connection, the current is the same through each component regardless of any kind of components are used or their values. The voltage drops across each component in the circuit are dependent upon the values of the components used in the circuit. Another way to view a series connection is that the positive end of each component is connected to the negative end of the previous component in a 'one after the other' arrangement. The negative end of each component is also connected to the positive end of the next component.

It is one of which every component is arranged in a series connection. Hence series circuit will have same current at all points of the circuit. The voltage drop across each component in the circuit adds up to sum of voltage source across each component and of an equivalent component value. Breaking of the series circuit will make entire circuit to stop working. Suppose consider the three bulbs are connected in series connection and if even one bulb burns out or broken then all the three bulbs will stop working as well. In series circuit components like current (I) is sum of all the element and Voltage is sum of all the voltage drops and resistance is the sum of individual resistances.

Explanation:

3 0
2 years ago
Other questions:
  • toThePowerOf is a method that accepts two int arguments and returns the value of the first parameter raised to the power of the
    6·1 answer
  • Which payment type is best if you are trying to sick to a budget?
    15·1 answer
  • What is the output of the following Python program? try: fin = open('answer.txt') fin.write('Yes') except: print('No') print('Ma
    9·1 answer
  • You must have an active ____ to test external links.
    5·1 answer
  • Write a program in python to test if given number is prime or not.
    6·2 answers
  • please help no one is helping me on this one
    9·1 answer
  • Rolulzoss<br>A. State three positive uses of computers in the government sector​
    10·1 answer
  • What are the main dimensions of information system and their components
    13·1 answer
  • Suppression of politically or socially unacceptable co
    5·1 answer
  • The technologist has recorded the red cell morphology as macrocytic. which mcv value would confirm this observation?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!