Sunday, 27 November 2011

C++ Program For Search A Number In Array


#include<iostream.h>
#include<conio.h>
void main()
 {
  int a[5],i,num;
  cout<<"enter 5 numbers";
  for(i=0;i<5;i++)
   cin>>a[i];
  cout<<"enter number";
  for(i=0;i<5;i++)
   if(a[i]==num)
    cout<<"number found"<<i;
   else
    cout<<"number not found";
getch();
 }

No comments:

Post a Comment