Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int ls(int [],int,int);
- int main()
- {
- const int size=6;
- int arr[size];
- int num;
- for(int i=0;i<=size;i++){
- cout<<"\nEnter integers : ";
- cin>>arr[i];
- }
- cout<<"\nEnter Integer to find : ";
- cin>>num;
- cout<<"\nIndex is ="<<ls(arr,size,num);
- return 0;
- }
- int ls(int arr[],int size,int num){
- for(int i=0;i<=size;i++){
- if(num==arr[i]){
- num=i;
- return num;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement