Monday, April 20, 2020

C++ Challenge #2 | Find number exists in Array using C++ in Urdu Hindi (...





In this lecture we are going to solve number is exists in array or not using c++ programming language.





here is code

#include <iostream>
using namespace std;
int main(){

int numbers[5] = {3,6,7,1,8};

int find_number;

int found = 0;

cout << "Enter Number a number to find in a array" <<endl;

cin >> find_number;



for(int i = 0; i < 5; i++){
if(find_number == numbers[i]){
found = 1;


}
}




if(found == 1){
cout << "number is exist";

}else{
cout << "number not found";
}



return 0;



}



No comments:

Post a Comment