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
vfiekz [6]
2 years ago
6

Part 1 Given 3 integers, output their average and their product, using integer arithmetic. Ex: If the input is 10 20 5, the outp

ut is: 11 1000 Note: Integer division discards the fraction. Hence the average of 10 20 5 is output as 11, not 11.666666666666666. Submit the above for grading. Your program will fail the test cases (which is expected), until you complete part 2 below but check that you are getting the correct average and product using integer division. Part 2 Also output the average and product, using floating-point arithmetic. Ex: If the input is 10 20 5, the output is: 11 1000 11.666666666666666 1000.0
Computers and Technology
1 answer:
MaRussiya [10]2 years ago
6 0

Answer:

a = int(input("Enter first number: "))

b = int(input("Enter second number: "))

c = int(input("Enter third number: "))

avg = (a + b + c) / 3

product = a * b * c

print(str(int(avg)) + " " + str(product))

print(str(avg) + " {:.1f}".format(product))

Explanation:

*The code is in Python

Ask the user for three integers, a, b, and c

Calculate their average, sum the numbers and divide by 3

Calculate their product

Print avg and product as integer numbers, be aware that I type casted the avg to int

Print avg and product as floating point numbers, be aware that I used format method to print one decimal for product

You might be interested in
| HELP PLS! C++ Sorting arrays can be performed using either Selection Sort or Insertion Sort or
Sholpan [36]

Answer:

wwhwwwwnlcw lcwl. wl w l. w la a. a. ac aa cw w w w. w. w. w w. ww w. w w w. w w w ww w w. w w ww. w cs s js jw jw kw kw ks jpsbp svkhs ksl oheo

8 0
2 years ago
In Python please.
Mazyrski [523]

Answer:

I dont know a lot about that but i know how to skeeo, i am reallyu good at sleeping.

Explanation:

7 0
3 years ago
1. Write a high level algorithm for cooking a cheeseburger.
pishuonlain [190]

Answer:

1.  A high level algorithm for cooking a cheeseburger could be:

  1. Heat fry pan
  2. Cook one side of the hamburger
  3. Wait
  4. Turn hamburger upside down
  5. Put cheese over hamburger
  6. Wait
  7. Cut hamburger bread in half
  8. Put cooked hamburger inside bread
  9. End (eat)

2. A detailed algorithm for cooking a cheeseburger could be:

  1. Place fry pan over the stove heater
  2. Turn on heater (max temp)
  3. IF fry pan not hot: wait, else continue
  4. Place raw hamburger on fry pan
  5. IF hamburger not half cooked: Wait X time then go to line 5, else continue
  6. Turn hamburger upside down
  7. Put N slices of cheese over hamburger
  8. IF hamburger not fully cooked: Wait X time then go to line 8, else continue
  9. Turn off heater
  10. Cut hamburger bread in half horizontally
  11. Put cooked hamburger on one of the bread halves.
  12. Put second bread half on top of hamburger
  13. End (eat)

Explanation:

An algorithm is simply a list of steps to perform a defined action.

On 1, we described the most relevant steps to cook a simple cheeseburger.

Then on point 2, the same steps were taken and expanded with more detailed steps and conditions required to continue executing the following steps.

In computational terms, we used pseudo-code for the algorithm, since this is a list of actions not specific to any programming language.

Also we can say this is a structured programming example due to the sequential nature of the cooking process.

7 0
2 years ago
What will happen if you type pseudocode in another language's programming environment and try to run the
wariber [46]

Answer:

You will get compile error

Explanation:

7 0
2 years ago
The following problem illustrates the way memory aliasing can cause unexpected program behavior. Consider the following function
laila [671]

Answer:

A

Explanation:

The value will be the original stored in the int variables. This is because the method swap(int xp, int yp) accepts xp and yp parameters by value (They are passed by value and not by reference). Consider the implementation below:

public class Agbas {

   public static void main(String[] args) {

   int xp = 2;

   int yp = xp;

   swap(xp,yp); //will swap and print the same values

       System.out.println(xp+", "+yp); // prints the original in values 2,2

 int xp = 2;

   int yp = 5;

   swap(xp,yp); // will swap and print 5,2

       System.out.println(xp+", "+yp); // prints the original in values 2,5

   }

   public static void swap(int xp, int yp){

       int temp = xp;

       xp = yp;

       yp = temp;

       System.out.println(xp+", "+yp);

   }

}

5 0
3 years ago
Other questions:
  • Difference between entropy and enthalpy is
    9·1 answer
  • How many possible keys does the playfair cipher have? an approximate power of 2
    14·1 answer
  • What does the headgear of a mine do
    6·2 answers
  • The Fibonacci numbers are the numbers
    15·1 answer
  • Who distributes IP Address?
    10·1 answer
  • Hey friends,<br><br> What is a IT form?<br><br> thanks
    12·1 answer
  • Which line of code will eliminate the element “calculator” from an array of supplies?
    13·1 answer
  • Activity
    7·1 answer
  • What is the primary way that social networks work? Multiple Choice providing a security system for communication online connecti
    5·1 answer
  • Communication between a computer and a keyboard involves ______________ transmission.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!