Monday, 19 January 2015

Input an Array of length N and Display the numbers that occurs single time (not repeated numbers) in array in c++



#include
using namespace std;
int main()
{
  int n;
  cout<<"\n________________________________________________________________________________\n";
  cout<<"\t\t....PRINTS THOSE NUMBERS WHICH ARE NOT REPEATED.... ";
  cout<<"\n________________________________________________________________________________\n";
  cout<<"\t\t\tHow many Numbers in array :\t";cin>>n;
  int arr[n],p;
  cout<<"\n\n\t\tEnter "<>arr[j];
  }
  cout<<"\n________________________________________________________________________________\n";
  cout<<"\t\t\tThe Numbers That are Not repeated...";
  cout<<"\n________________________________________________________________________________\n";
  for(int i=1;i<=n;i++)
  { p=0;
    for(int j=1;j<=n;j++)
        if(arr[i]==arr[j])
            p+=1;  
    if(p==1)
        cout<<"\t\t\t>>\t"<
// Run the code using devC++.

0 comments:

Post a Comment