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.

write a programme to discribe maximum and minimum between 3 numbers

+23 votes
asked Oct 3 by Naveen (200 points)

8 Answers

0 votes
answered Oct 4 by Peter Minarik (80,300 points)
edited Oct 5 by Peter Minarik
What language are you after?

For the language C/C++, you can find similar examples here: https://question.onlinegdb.com/14977/how-to-write-program-greatest-number

Look at that example and try to do your own implementation.

If you get stuck, share your work so far (orange SHARE button in the code editor) and we'll be happy to help you get back on track.

Good luck!
0 votes
answered Oct 4 by MOHAMMAD TAJA (140 points)
please check if this is correct

def find_maximum(num1, num2, num3):
    return max(num1, num2, num3)

def find_minimum(num1, num2, num3):
    return min(num1, num2, num3)

num1 = float(input("Enter the first number: "))
num2 = float(input("Enter the second number: "))
num3 = float(input("Enter the third number: "))

maximum = find_maximum(num1, num2, num3)
minimum = find_minimum(num1, num2, num3)

print("Maximum number is:", maximum)
print("Minimum number is:", minimum)
0 votes
answered Oct 5 by Sarthak Pandit (140 points)

printf("a is greater);

else if (b>c&&b>a)

printf("b is greater );


printf("c is greater);
0 votes
answered Oct 6 by ArshAgrawal21 (140 points)
take three variable input in array and then sort the array by using any sorting tech. Then the first element is the minimal element(a[0]) and the last element us the maximum element (a[1]) ;

This is how you get the max and min element in three numbers.
0 votes
answered Oct 6 by Sino (140 points)
program FindMinBetween3Numbers;
uses math;
var num1, num2, num3, ans : int64;
w : string;
ans := 0;
writeln('enter first number');
 writeln('enter second number');
 writeln('enter three number');
writeln('write "min" if you wanna find minimum and write "max" if you wanna find maximum');

if w = 'min' then
ans:= min(min(num1, num2), num3);
writeln('the minimum between', ' ', num1, ', ', num2, ' and ', num3, ' is ', ans );

if w = 'max' then
ans:= max(max(num1, num2), num3);
writeln('the maximum between', ' ', num1, ', ', num2, ' and ', num3, ' is ', ans );

0 votes
answered Oct 6 by Gulshan Negi (1,380 points)

Well, it depends on which programming language you are looking to do this. 

For example, in Python:

# Input three numbers from the user
num1 = float(input("Enter the first number: "))
num2 = float(input("Enter the second number: "))
num3 = float(input("Enter the third number: "))

# Find the maximum and minimum using conditional statements
maximum = num1  # Assume num1 is the maximum initially
minimum = num1  # Assume num1 is the minimum initially

# Compare with num2 and num3
if num2 > maximum:
    maximum = num2
elif num2 < minimum:
    minimum = num2

if num3 > maximum:
    maximum = num3
elif num3 < minimum:
    minimum = num3

# Display the results
print(f"The maximum number is: {maximum}")
print(f"The minimum number is: {minimum}")


+1 vote
answered Oct 6 by Łucky (160 points)
#include <stdio.h>

int main()
    int a, b, c;
    printf("Enter number a : ");
    printf("Enter number b : ");
    printf("Enter number c : ");
    if(a> b && a> c){
        printf("a is max");
    else if(b> a && b> c){
        printf("b is max");
        printf("c is max");

    return 0;
0 votes
answered Nov 27 by nasiya (240 points)


int main() {

    int i,arr[100],n,max,min;

    printf("Enter the limit:");



    printf("Enter the values:");





    printf("Entered elements are:");





    max = arr[0];

    min = arr[0];



        if(arr[i] > max)




        if(arr[i] < min)





    printf("\nMaximum elements:%d",max);

    printf("\nMinimum elements:%d",min);


commented 3 days ago by Ananya K.J (300 points)
#include <iostream>

using namespace std;

int main()
    int a,b,c;
    if(a>=b && a>=c)
    else if(b>=a &&b>=c)

    return 0;
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.