how to know minimum of two numbers

+2 votes
asked Aug 21 by Hari

8 Answers

0 votes
answered Aug 22 by KIRAN SIVAJI AKULA
'''

http://question.onlinegdb.com/4382/how-to-know-minimum-of-two-numbers

Author: Akula. Kiran Sivaji,MCA[NIT],NCC-C

Date:22-08-2019,

Version: Python2.7

Note: If u use Python3.7 then

1)use input() instead of raw_input()

2)use print(" ur msg") instead of print " ur msg"

Then u got same output in python 3.7  version also

'''

a=raw_input("Enter first number: ")

b=raw_input("EnterSecond number: ")

if a<b:

print "Min.No.is ",a

else:

print "Min.No. is ",b

'''

OutPut:-

C:\Users\AKULA>python MinNo.py

Enter first number: 5

EnterSecond number: 6

Min.No.is  5

C:\Users\AKULA>python MinNo.py

Enter first number: 0

EnterSecond number: 8

Min.No.is  0

C:\Users\AKULA>python MinNo.py

Enter first number: 89

EnterSecond number: 78

Min.No. is  78

C:\Users\AKULA>

'''
0 votes
answered Aug 22 by Suhas Gowda K R

//java program
class main
{
public static void main(String args[])
{
int x=Integer.parseInt(args[0]);
int y=Integer.parseInt(args[1]);
int m=Math.min(x,y);
System.out.println(""+m);
}
}

+1 vote
answered Aug 23 by Vitassy

It's easy don't worry

Let's take two numbers a and b.

---------------------------------------------------------------

if a == b :                                              
    print ("You two numbers are the same !")
elif a < b :                                              
    print ( str(a) + " is the smallest one ")
else :                                                    
    print ( str(b) + " is smaller")  
              

-----------------------------------------------------------------

Feel free to ask if anything i made isn't clear ^^

0 votes
answered Aug 29 by (140 points)
a=int(input("Enter a  value:"))

b=int(input("Enter b value:"))

if(a<b):

      print("a value is minimum then b value.")

else:

      print("a value is minimum then b value.")
0 votes
answered 5 days ago by gameforcer
a = 1
b = 3
print(min(a,b))
0 votes
answered 5 days ago by anonymous
#include <stdio.h>

int main(){

int a, b;

printf("Enter a number: ");

scanf("%d", &a);

printf("Enter another number: ");

scanf("%d", &b);

if(a<b){

printf("A: %d is smaller than B: %d", a, b);

}

else{

printf("B: %d is smaller than A: %d", b, a);

}

return 0;

}
0 votes
answered 4 days ago by (140 points)
num1 = input("Enter 1st number")
num2 = input("Enter 2nd number")

if(num1 < num2):
    print("Num 1 is smaller")
elif(num1 > num2):
    print("Num 2 is smaller")
else:
    print("Both are equal")
0 votes
answered 1 day ago by (140 points)
import numpy as np

x = np.array([5, 6])

min = np.min(x)

max = np.max(x)
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...