Find Max and Min

Description:

Write a program to enter the numbers till the user wants and at the end it should display the maximum and minimum number entered. Test Case 1 Input (stdin) 56 y 34 y 23 y 67 y 89 y 100 n Expected Output Maximum Number :100 Minimum Number :23 Test Case 2 Input (stdin) 23 y 12 y 76 y 100 y 45 y 09 n Expected Output Maximum Number :100 Minimum Number :9

Program :

#include<iostream>

using namespace std;

int main()

{

    int n, max=0, min=32767;

    char choice;

    do

    {

        cin>>n;

        if(n>max)

            max=n;

        if(n<min)

            min=n;

        cin>>choice;

    }

    while(choice=='y' || choice=='Y');

    cout<<"Maximum Number :"<<max<<"\nMinimum Number :"<<min;

    return 0;

}