0

Can anyone explain working of this code(dry run)

#include <iostream> using namespace std; int main() { int array[10],i,num,n,c=0,pos; cout<<"entr the array size:\n" ; cin>>n; cout<<"enter array elements\n"; for(i=0;i<n;i++) { cin>>array[i]; } cout<<"enter no to be searched\n"; cin>>num; for(i=0;i<n;i++) { if (array[i]==num) { c=1; pos=i+1; break; } } if (c==0) { cout<<"no not found"; } else { cout<<num<<"no fond at pos"<<pos; } return 0; }

17th Jan 2019, 9:37 PM
Usman Zafar
Usman Zafar - avatar
1 Answer
+ 7
Dry run to the code of USMAN ZAFER I have click picture of my notebook see my post on activity feed above is heading
17th Jan 2019, 10:57 PM
AKS
AKS - avatar