Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Linear search
#include <iostream> using namespace std; int main() { int arr[5]={2,4,1,3,6}; int num; int flag=0; cout<<"enter the number you wish to search"; cin>>num; for( int i=0; i<5; i++) { if(arr[i] == num) { cout<<num<<"is available at position"<<i; flag=1; } break; } if(flag==0) cout<<"not found"; }
run
|
edit
|
history
|
help
1
Remove break on nest
by Pascual11, 5 months ago
Please
log in
to post a comment.
marquee text in C++
Atomic trivial default constructor
even number
6 7
Rounding float to nearest 1000 (fixed)
insertion sort
Merge Sort
wasm test for node
std::99 bottles of beer!
Graphs Iteration2 Directed Graphs
Remove break on nest
by Pascual11, 5 months agoPlease log in to post a comment.