# write a programme to discribe maximum and minimum between 3 numbers

answered Oct 4 by (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!
answered Oct 4 by (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)
answered Oct 5 by (140 points)
if(a>b&&a>c)

printf("a is greater);

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

printf("b is greater );

el;se

printf("c is greater);
answered Oct 6 by (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.
answered Oct 6 by (140 points)
program FindMinBetween3Numbers;
uses math;
var num1, num2, num3, ans : int64;
w : string;
begin
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
begin
ans:= min(min(num1, num2), num3);
writeln('the minimum between', ' ', num1, ', ', num2, ' and ', num3, ' is ', ans );
end;

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

end.
answered Oct 6 by (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}")

Thanks

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

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

return 0;
}
answered Nov 27 by (240 points)

#include<stdio.h>

int main() {

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

printf("Enter the limit:");

scanf("%d",&n);

printf("Enter the values:");

for(i=0;i<n;i++)

{

scanf("%d",&arr[i]);

}

printf("Entered elements are:");

for(i=0;i<n;i++)

{

printf("\n%d\t",arr[i]);

}

max = arr[0];

min = arr[0];

for(i=0;i<n;i++)

{

if(arr[i] > max)

{

max=arr[i];

}

if(arr[i] < min)

{

min=arr[i];

}

}

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

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

}

commented 3 days ago by (300 points)
#include <iostream>

using namespace std;

int main()
{
int a,b,c;
cin>>a;
cin>>b;
cin>>c;
if(a>=b && a>=c)
{
cout<<a;
}
else if(b>=a &&b>=c)
{
cout<<b;
}
else
{
cout<<c;
}

return 0;
}