Thursday, 16 October 2014

Write a program that reads 10 numbers from the user into an array and count the number of negative numbers in it

Leave a Comment
  


#include<iostream>
#include<iomanip>
using namespace std;
void main()
{
    int counter=0;
    double numbers[10];
    for(int i=0;i<10;i++)
        {
            cout<<"Please Enter Value  = ";
            cin>>numbers[i];
            if(numbers[i]<0)
            {
                counter++;
            }
        }
    cout<<"Total Negtive Numbers Are = "<<counter<<endl;
    system("pause");
}
Output:
 

If You Enjoyed This, Take 5 Seconds To Share It