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
VikaD [51]
2 years ago
8

Write a program whose inputs are two integers, and whose output is the smallest of the two values.

Computers and Technology
1 answer:
andrezito [222]2 years ago
8 0

Method 1 :

Using If else statements: If the condition checks whether num1 is smaller than num2 if so it will print 'Smallest of these two integers is num1'.

else it will print 'Smallest of these two integers is num2'

Method 2:

Using the 'min' method: using the method min(num1,num2), the program finds the smallest value and prints it directly to the user.

Python Program using method 1

#PYTHON PROGRAM TO FIND SMALLEST INTEGER VALUE FROM TWO INPUTS FROM USER - Method 1

#Accepts inputs from user

num1 = int (input ("Enter your first number:")) #Gets the first integer input from user and stores in num1

num2 = int (input ("Enter your second number: ")) #Gets the second integer input from user and stores in num2

#Finding output by if else

#Checks num1 smaller than num2

if (num1 < num2):

#assign num1 to small

small = num1

else:

#assign num2 to small

small = num2

 

print ("Smallest of these two integers is", small)

Python Program using method 2

#PYTHON PROGRAM TO FIND SMALLEST INTEGER VALUE FROM TWO INPUTS FROM USER - Method 2

#Accepts inputs from user

num1 = int (input ("Enter your first number:")) #Gets the first integer input from user and stores in num1

num2 = int (input ("Enter your second number: ")) #Gets the second integer input from user and stores in num2

#Finding output using min method

print("\n Smallest of these two integers is",min(num1,num2)) #Prints output to user

You might be interested in
The Uniform Electronic Transmission Act (UETA) a. declares that e-signatures are invalid. b. has only been adopted in a handful
ch4aika [34]

Answer:

d. declares that a contract or signature may not be denied enforceability just because it is in electronic form.

Explanation:

The Uniform Electronic Transmission Act (UETA) is one of the Uniform Acts and key laws of the United States of America. This Act was proposed by the National Conference of Commissioners on Uniform State Laws (NCCUSL) and has since been adopted by forty eight (48) states including the U.S Virgin Islands and the District of Colombia.

However, New York and Illinois have not adopted UETA but they have similar state legislations and laws that recognizes electronic signatures.

The main purpose of UETA is to give legal validity to electronic signatures, electronic contracts and the harmonization of laws regarding the retention of paper records such as checks across the United States of America.

Hence, the function of UETA is to create unison or harmony between the laws regarding records in paper format and the authenticity of electronic signatures.

An electronic signature can be defined as an electronic data such as symbols, signs or sound which are attached to purchase order, contracts or any other contractual agreements adopted by an individual as an agreement to the deal.

According to the Uniform Electronic Transmission Act (UETA), an electronic contract or signature may not be denied enforceability just because it is in electronic form.

In conclusion, both the electronic version of a contract and signature are valid, legal and enforceable across states where they are recognized in the United States of America.

6 0
3 years ago
Sequential codes may be used to represent complex items or events involving two or more pieces of related data.
katrin2010 [14]

Answer:

The answer is "Option B".

Explanation:

Sequential codes are modules that work toward the solution of a problem that is arranged in a serialized manner. It is also known as serial codes, It is code in which the following two digits differ by a single digit in the binary representation.

  • It helps to decide, which task and how long it will take.
  • It uses communication to provide synchronized and shares resources between tasks.
4 0
4 years ago
Please help me in this question​
Natalija [7]

Answer:

Explanation:

i think operands

5 0
3 years ago
Read 2 more answers
What is the effects of computer and internet attacks​
ZanzabumX [31]

Answer:

ads, damage, or bugs

Explanation:

7 0
3 years ago
Read 2 more answers
Write a program that asks a user to enter a date in month day year format (for example 10 12 2016) and displays the day of the w
AleksAgata [21]

Answer and Explanation:

Using javascript:

function dayof_theweek(){

var TodayDate = window. prompt("enter today's date in the format 'year, month, day' ");

var Datenow=new date(TodayDate);

var Dayofweek=Datenow.getday();

var Days=["monday","Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];

if(Dayofweek==indexOf(Days[Dayofweek]))

{

document.createTextnode(Days[Dayofweek]);

}

}

The program above uses a date object which uses the method getday to get the day of the week(get day returns an integer from 0 to 6).we then use a comparison operator == to test the condition that returned value Dayoftheweek is same with the index of the array Days and then print to a html document. The program may need improvements such as the fact that errors may arise when proper input isn't given, and therefore must be handled.

8 0
3 years ago
Other questions:
  • Why is the protocol down, even though you issued the no shutdown command for interface vlan 99?
    5·2 answers
  • When one block is executed after another block in order from top to bottom, this is called ______ (see picture) Question 31 opti
    8·1 answer
  • If someone receives a shock, or a piece of equipment is throwing sparks or arcing you should try to pull them away from the sour
    7·1 answer
  • Phoebe has to give a permission about recycling. Where should she look while presenting?
    11·1 answer
  • What was the first fully computer animated feature film?
    13·1 answer
  • Antivirus software uses ________ to search for known viruses.
    9·1 answer
  • Why bootable installer preparation is important? explain
    9·1 answer
  • Which company was the first to develop personal computers?
    6·1 answer
  • That’s what I have so far. I need help!
    5·1 answer
  • What are different social phenomenas are you aware of that used part of a social movement, change, or cause
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!