Muhammad Al – Xorazmiy nomidagi Toshkent Axborot Texnologiyalari Universiteti 008-2 guruh talabasi Xudaykulov Xamidulloning Dasturlash II fanidan 2-shaxsiy topshirig`i.
(25 - Variant)
Fan o`qituvchisi: Dauletov Adilbek
#include
#include
int main() {
std::array myarray;
unsigned int i;
for (int i = 0; i < 40; i++) {
myarray[i] = i;
}
std::cout << "Masalaning sharti bo`yicha elementlar: ";
for (int i = 0; i < 40; i++) {
if (myarray[i] % 5 == 0) {
std::cout << " " << myarray[i]*3;
}
}
std::cout << endl;
}
Ekranga chiqqan natijalar : 0, 15, 30, 45, 60, 75, 90, 105.
#include
#include
int main() {
std::listmyList = { 5, -2, 12, -8, 9, -10, 4 };
myList.remove_if([](int i) { return i %2!==0;});
for (int i : myList) {
std::cout << i << " ";
}
return 0;
}
Do'stlaringiz bilan baham: |