answer.
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
Paha777 [63]
2 years ago
12

Write a function named max that accepts two integer values as arguments and returns the value that is the greater of the two. Fo

r example, if 7 and 12 are passed as arguments to the function, the function should return 12. Use the function in a program that prompts the user to enter two integer values. The program should display the value that is the greater of the two
Computers and Technology
1 answer:
RoseWind [281]2 years ago
6 0

Answer:

The solution code is written in Python

  1. def max(a, b):
  2.    if(a > b):
  3.        return a  
  4.    else:
  5.        return b
  6. num1 = int(input("Please input the first number: "))
  7. num2 = int(input("Please input the second number: "))
  8. print(max(num1, num2))

Explanation:

Firstly create a function max that accepts two input, a and b, as required by question (Line 1). In the function, create if statement to check if a greater than b return a and vice versa (Line 2 -5).

In the main program (Line 7 - 10), prompt user to input two numbers (Line 7 - 8). At last call the function by passing num1 and num2 as arguments and print the result (Line 10).

You might be interested in
Which change signaled a musical progression toward rock and roll?
postnew [5]
It is the inclusion of the bass section
7 0
2 years ago
3.26 LAB: Leap Year A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to rotate a
Taya2010 [7]

Answer:

// program in C++ to check leap year.

// include header

#include<iostream>

using namespace std;

// main function

int main() {

// variable

  int inp_year ;

  // ask user to enter year

  cout<<"Enter year:";

  // read year

  cin>>inp_year;

  // check year is leap or not

  if (((inp_year % 4 == 0) && (inp_year % 100 != 0)) || (inp_year % 400 == 0))

  // if leap year , print leap year

     cout<<inp_year<<" is a leap year.";

  else

  // print not leap year

     cout<<inp_year<<" is not a leap year.";

  return 0;

}

Explanation:

Read year from user.Then check if year is divisible by 4 and not divisible by 100 or year is divisible by 400 then year is leap year.otherwise year is not  leap year.

Output:

Enter year:1712                                                                                                            

1712 is a leap year.

6 0
2 years ago
Read 2 more answers
What is the distance rn between the point of application of n⃗ and the axis of rotation? what is the distance rw between the poi
Mandarinka [93]

Complete Question.

A. Suppose that you are holding a pencil balanced on its point. If you release the pencil and it begins to fall, what will be the angular acceleration when it has an angle of 10.0 degrees from the vertical?

B. What is the distance rn between the point of application of n⃗ and the axis of rotation?

C. What is the distance rw between the point of application of w⃗ and the axis? enter your answers in meters separated by a comma?

Answer:

A. â = - 17rad/s²

B. rn = 0, meters

C. rw = 0.074, meters

Explanation:

Where;

l = length of the pencil

θ = angle between the vertical line and the pencil

â = angular acceleration.

The torque due to weight about the pivotal point is negative since it's clockwise;

t = - mg(l/2)sinØ ..... equation 1

torque with respect to angular acceleration;

t = Iâ ..... equation 2

The moment of Inertia of the pencil about one end;

I = (ml²)/3

Substituting I into equation 2;

t = [(ml²)/3]×â

Equating the equation, we have;

[(ml²)/3]×â = - mg(l/2)sinØ

â = (-3gsinØ)/2l

â = (-3*9.8*sin10°)/(2*0.15)

Angular acceleration, â = -17rad/s²

B. The normal force is acting at the normal force only, so the distance r n between the point of application of n ⃗ and the axis of rotation is zero because the axis of pencil is passing the same point of application w.

C. rn = (lcosØ)/2

rn = (0.15 * cos10°)/2

rn = (0.15 * 0.9848)/2

rn = (0.1477)/2

rn = 0.074m.

Since the gravity acts at exactly half of the length of pencil, distance r w between the point of application of w⃗ and the axis equals 0.074m.

8 0
2 years ago
zybooks cis 110 challenge activity 9.8.1 Write a program that takes in a positive integer as input, and outputs a string of 1's
irakobra [83]

Answer:

public class IntegerToBinary

{

public static void main(String[] args) {

 integerToBinary(6);

}

public static void integerToBinary(int num){

    while(num > 0){

       System.out.print(num%2);

       num = Math.floorDiv(num, 2);

    }

}

}

Explanation:

*The code is in Java.

Create a function called integerToBinary that takes one parameter, num

Inside the function, create a while loop that iterates while the num is greater than 0. Inside the loop, print the num%2. Then, get the floor division of the num by to and assign it to the num.

Inside the main, call the function with parameter 6.

7 0
2 years ago
A team of students is collaborating on a program to obtain local weather data from a website, and predict weather-related school
love history [14]

Answer:

1. Using meaningful names for all variables and functions.

2. Use shorter blocks of codes wherever possible

Explanation:

Their code should be easy to read, this can be achieved by avoiding complex syntax, basically they should adopt the two methods stated in the answer

7 0
2 years ago
Other questions:
  • True or false? The largest component of a database is a field.
    12·2 answers
  • Ben's team is working on an English project. The members want to see everyone's progress on their part of the project. What tech
    7·2 answers
  • A form that dedicates a page for each item retrieved for a case; it allows investigators to add more detail about exactly what w
    10·1 answer
  • Determine the number of bytes necessary to store an uncompressed binary image of size 4000 × 3000 pixels.
    9·1 answer
  • The area of a square is stored in a double variable named area. write an expression whose value is length of the diagonal of the
    11·1 answer
  • Use the image below to answer this question.
    14·1 answer
  • Suppose that, even unrealistically, we are to search a list of 700 million items using Binary Search, Recursive (Algorithm 2.1).
    11·1 answer
  • A spreadsheet keeps track of student scores on all the exams in a course. Each row of the spreadsheet corresponds to one student
    14·1 answer
  • James has created some artwork portraying life on a different planet. He wants to show a world where everything is beautiful and
    7·1 answer
  • Team A found 342 errors during the software engineering process prior to release. Team B found 184 errors. What additional measu
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!