A Program to find number in an array #include #include void main() { int a[10]={1,5,8,9,4,6,0,3,7,2}; int i,n,index=-1; cout<<"enter any no"; cin>>n; for(i=0;i<=9;i++) { if(a[i]==n) index=i; } if(index==-1) cout<<"number not found"; else cout<<"number found at index "< } |
All times are GMT +5. The time now is 11:45 AM. |
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.