Advertisement
Guest User

Untitled

a guest
Dec 19th, 2014
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. int ls(int [],int,int);
  4. int main()
  5. {
  6. const int size=6;
  7. int arr[size];
  8. int num;
  9. for(int i=0;i<=size;i++){
  10. cout<<"\nEnter integers : ";
  11. cin>>arr[i];
  12. }
  13. cout<<"\nEnter Integer to find : ";
  14. cin>>num;
  15. cout<<"\nIndex is ="<<ls(arr,size,num);
  16. return 0;
  17. }
  18. int ls(int arr[],int size,int num){
  19. for(int i=0;i<=size;i++){
  20. if(num==arr[i]){
  21. num=i;
  22. return num;
  23. }
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement