TGTGInsighttelegram intelligenceLIVE / telegram public index
Innhold
Innholdet i innlegget
// Problem 11 bool sol = false; int n; cout<<"n = "; cin>>n; int nums[n], target; for(int i=0; i<n; i++){ cout<<"nums["<<i<<"] = "; cin>>nums[i]; } cout<<"traget = "; cin>>target; //{2, 5, 6, 7, 8, 9} t = 10 // o'zgaruvchi for(int i=0; i<n; i++){ for(int j=0; j<n; j++){ if(i==j) continue; if(nums[i]+nums[j]==target) { cout<<"["<<i<<","<<j<<"]"; sol = true; break; } } if(sol) break; }