Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

how to know minimum of two numbers

0 votes
asked Aug 21, 2019 by Hari

11 Answers

0 votes
answered Aug 22, 2019 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, 2019 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, 2019 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, 2019 by mahaboob jhony (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.")
+1 vote
answered Oct 9, 2019 by gameforcer
a = 1
b = 3
print(min(a,b))
0 votes
answered Oct 9, 2019 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 Oct 10, 2019 by Rajesh Mahajan (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 Oct 13, 2019 by Leonardo Brito de Souza (140 points)
import numpy as np

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

min = np.min(x)

max = np.max(x)
0 votes
answered Oct 18, 2019 by DHANUSH S (140 points)
a=int(input("enter the first no:")

b=int(input("enter the second no:")

if(a<b):

    print("first  no is minimum")

else:

   print("second no is minimum")
0 votes
answered Oct 21, 2019 by anonymous
a=int(input("enter first number"))

b=int(input("enter second number"))

if (a>b):

print(b,"is minimum")

else:

print(a,"is minimum")
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.
...