Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- void search (int a[], int n, int k)
- {
- for(int i=0;i<n;i++)
- {
- for(int j=0;j<n;j++)
- {
- if (a[i]+a[j]==k)
- {
- printf("items found:%d%d",i,j);
- return;
- }
- }
- }
- printf("items not found");
- }
- void main()
- {
- int a[]= {1,2, 3, 4, 5, 6};
- int n =sizeof(a)/sizeof(a[0]);
- search (a, n, 3);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement