Computer Science, asked by muskan481367, 1 year ago

write a program to input three numbers of the user find the smallest and largest​

Answers

Answered by sswaraj04
1

Answer:

#include <iostream>

using namespace std;

int main()

{

   int a,b,c;

   cout<<"Enter first number";

   cin>>a;

   cout<<"Enter second number";

   cin>>b;

   cout<<"Enter third number";

   cin>>c;

   if(a>b&&a>c)

   {

       cout<<a<<" is largest number"<<endl;

   }

   if(b>a&&b>c)

   {

       cout<<b<<" is largest number"<<endl;

   }

   if(c>a&&c>a)

   {

       cout<<c<<" is largest number"<<endl;

   }

   if(b<a&&b<c)

   {

       cout<<b<<" is smallest number"<<endl;

   }

   if(a<b&&a<c)

   {

       cout<<a<<" is smallest number"<<endl;

   }

   if(c<b&&c<a)

   {

       cout<<c<<" is smallest number"<<endl;

   }

   return 0;

}

Explanation:

Hope it helps :-)

Mark it brainliest

Answered by arunkumar516235
0

Explanation:

This is a flow-chart in java.

if you want coding this so please use google.

it's have many good website to help these type of question.

public class MaxMinNumber {

public static void main(String[] args) {

Scanner in = new Scanner(System.in);

System.out.println("Enter first number: ");

int n1 = in.nextInt();

System.out.println("Enter second number: ");

int n2 = in.nextInt();

System.out.println("Enter third number: ");

int n3 = in.nextInt();

int largest = Math.max(n1, Math.max(n2, n3));

System.out.println("Largest among (" + n1 + ", " + n2 + ", " + n3 + ") is: "

+ largest);

int smallest = Math.min(n1, Math.min(n2, n3));

System.out.println("Smallest among (" + n1 + ", " + n2 + ", " + n3 + ") is: "

+ smallest);

in.close();

}

thanks.

Attachments:
Similar questions