Write a Program in C++ to Find Negative Number in an Array

This simple Program finds the negative number in C++ program . The Program asked user to enter some positive and negative numbers . After this the program will display that number which are less than zero.

Source Code

#include<iostream>
using namespace std;
int main ()
{
 int num [7];
 for (int i =0;i<7;i++)
 {
  cout<<" Enter Your Number : ";
  cin>>num[i];
 }
 cout<<" The Negative Numbers are : \n ";
  for (int i =0; i<7; i++)
  {
   if ( num[i]<0)
   {
    cout<<num[i]<<endl;
   }
  }
  }

Output of the Program

Find negative number in array


Share on Google Plus

About Asad

Asad Niazi is Software Engineer , Programmer, Web Developer and a young mentor of BloggersTown and PProgramming. Asad Love to writes about Technology, Programming, Blogging and make money online.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment