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]
3 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]3 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
Que relacion tiene Las palabras: fermentacion-vino y clonacion- dolly​
rjkz [21]

Answer:

Al final, la hembra adulta da a luz a un animal que tiene la misma composición genética que el animal que donó la célula somática. A esta cría se le conoce como clon. La clonación reproductiva podría requerir el uso de una madre sustituta para hacer posible el desarrollo del embrión clonado, tal como fue el caso del más famoso.

Explanation:

4 0
3 years ago
Using the physical mail analogy, what part of an address on an envelope is most like the ip address?
Slav-nsk [51]
The recipient IP address would would be the recipient home address. 
8 0
3 years ago
In which type of referencing do you get a warning message? Explain why.​
Art [367]

Answer:

These are the problems that are not severe enough to prevent processing. They mainly complain about the previous version of your document. In the case of command invalid, the latex gives a warning and henceforth it needs to be fixed.

Explanation:

There are some bugs in which they are not that severe that make the system not process.. but they are still mistakes in which might affect how the program run those parts.. like in JavaScript in the program i use, the minor bugs are like symbolized as yellow triangle and they are normally like signalizing a grammar error in the code and the app still runs but just that part of the code is invalid or reads wrong.. while big errors like codes that dont make sense, those make a red squareish that as soon as you try to run the program the debug console states in all red "Line 50(or whatever line) SyntaxError" or other things

5 0
3 years ago
Executive dashboards provide support primarily to analytical quantitative types of descisions. True or False
lana [24]

Answer: False

Explanation:

Executive dashboards is the tool that helps in displaying data, trend, metric KPI and other real-time data.This reporting gives information to organization and managers for working on any required improvement and way to expand their opportunities and work.

  • This tool does not focus on analytically qualitative based decision rather includes exception reporting of data and metrics, giving sight or big view of business performance etc rather than collecting data through surveys analysis or any interviewing process.
  • Therefore, the given statement is false.
4 0
3 years ago
Program 7 - Circle You write ALL the code, then run it - Produce the correct output. Turn in code and screen print of successful
fgiga [73]

Answer:

Here is the Circle class:

public class Circle {   // class definition

private int radius;    // private data member of type int of class Circle named radius that stores the value of radius

public Circle(int r) {   // parameterized constructor of class Circle that takes radius as argument

 radius = r;  }    // sets value of radius as r

public int getRadius() {   // accessor method to get the value of radius

 return radius;  }   // returns the current value of radius

public int Diameter() {   // method to compute diameter of a circle

 return radius * 2;  }   // multiply radius value by 2 to compute diameter of Circle

 

public double Area() {   // method to compute area of a circle

 return Math.PI  * Math.pow(radius, 2);   }   //the formula of area is

π x radius² where value of π is get using Math.PI

 

 public double Circumference() {   // // method to compute circumference of a circle

 return 2* Math.PI * radius;   }   }  //the formula of circumference is

2 x π x radius where value of π is get using Math.PI

Explanation:

Here is the Main class:

import java.util.Scanner;  //to accept input from user

public class Main {  //definition of Main class

public static void main(String[] args) {  //start of main method

   

    Scanner scanner = new Scanner (System.in);  //creates Scanner object to take input from user

    System.out.println("Enter radius: ");  //prompts user to enter radius

    int r = scanner.nextInt();  //reads the value of radius from user

 Circle c = new Circle(r);  // calls Constructor of Circle passing r as argument to it using the object c of class Circle

 

    if(c.getRadius()<=0){  //calls getRadius method to get current value of radius using objec and checks if this value (input value of r ) is less than or equal to 0

        System.out.println("Error!");   }  //when above if condition evaluates to true then print this Error! message

    else {  //if the value of radius is greater than 0

System.out.println("the radius of this Circle is: " +c.getRadius());  //calls getRadius method to return current value of r (input value by user)

System.out.println("the diameter of this Circle  is: " + c.Diameter());  //calls Diameter method to compute the diameter of Circle and display the result on output screen

System.out.printf("the circumference of this Circle  is: %.2f", c.Circumference());  //calls Circumference method to compute the Circumference of Circle and display the result on output screen

System.out.println();  //prints a line

System.out.printf("the Area of this Circle  is: %.2f", c.Area()); } }  }

//calls Area method to compute the Area of Circle and display the result on output screen

The program and its output is attached.

7 0
3 years ago
Other questions:
  • The set of specific, sequential steps that describe exactly what a computer program must do to complete the work is called a(n _
    14·1 answer
  • If you want to find out the specific questions you answered incorrectly on a particular examination, what option on the Web site
    6·1 answer
  • You have recently resolved a problem in which a user could not print to a particular shared printer by upgrading her workstation
    12·1 answer
  • What appears in the document after you have inserted a video?
    14·2 answers
  • If a small monster collector:- Has 16 small monster containment devices and intends to use all of them.
    10·1 answer
  • PLEASEEEEE HELLPPP IT'S URGENT!!!
    11·1 answer
  • HLOOKUP is used for Horizontal Data look ups while VLOOKUP is for Vertical Data look ups
    8·1 answer
  • When Ethan tries to delete row 7, an error message appears on the screen stating that the record cannot be deleted
    14·1 answer
  • Taking control of admin functionality and misusing sensitive data that are unauthorized to access are due to.
    8·1 answer
  • When an AC voltage is being measured
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!