Sunday, June 6, 2021

program enter the element in array and check the negative number using array (POP) (143)

#include<iostream>

using namespace std;

int main()

{

    int arr[10]; 

    int i;

    cout<<"Enter elements in array : ";

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

    {

        cin>>arr[i];

    }


    cout<<"\nAll negative elements in array are : ";

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

    {

        if(arr[i] < 0)

        {

            cout<<arr[i];

        }

    }


    return 0;

} 

No comments:

Post a Comment