Wednesday, December 8, 2021

 #include <iostream>

using namespace std;
int main()
{
    int n, i, maxnum = 0;
    cout << "enter the sixe of list : \n ";
    cin >> n;
    cout << "enter the  numbers to be included in the list :\n ";
    int numlist[n];
    // taking numbers from user using array
    for (i = 0; i < n; i++)
    {
        cin >> numlist[i];
    }
    cout << "entered list is \n";
    // showing numbers entered by user to the user using array
    for (i = 0; i < n; i++)
    {
        cout << numlist[i] << endl;
    }
    // checking if max num is greater of all or not if not assigning it the value of number it has checked the value
    // with and repeating the same till it becomes the greatest
    for (i = 0; i < n; i++)
    {
        if (maxnum < numlist[i])
        {
            maxnum = numlist[i];
        }
    }
    cout << endl
         << maxnum << "is the greatest number in the list you entered" << endl;
    // using the greatest number found above to check if it is less than other or not if not assigning the vale
    // and repeating the same till it becomes the lowest

    for (i = 0; i < n; i++)
    {
        if (maxnum > numlist[i])
        {
            maxnum = numlist[i];
        }
    }
    cout << endl
         << maxnum << "is the smallest number in the list you entered" << endl;
    return 0;
    //while checking the greatest and lowest i am comparing the numbers in array with successsive indices
}

1 comment:

Unknown said...

ok i like it pikaso

Software scope

 In software engineering, the software scope refers to the boundaries and limitations of a software project. It defines what the software wi...

Popular Posts