SWD013-L3 guruhi talabasi Mirzayev Muzaffarjonning dasturlash 2 fanidan 2-labaratoriya ishi.
17-variant
Savol: vector hosil qiling va unung tub elementlari yig’indisini toping.
#include
#include
#include
using namespace std;
int main()
{ vector myvector;
int a,b,d=0;
cin>>b;
for(int i=0;ia=rand()%30;
myvector.push_back(a);
cout<cout<cout<for(int i=0;ibool tub = true;
for(int j=2;j<=sqrt(myvector.at(i));j++){
if(myvector.at(i)%j==0){
tub=false;
break;
}
}
if(tub==true){
cout<d+=myvector.at(i);}
}
cout<return 0;
}
Do'stlaringiz bilan baham: |