1)
#include
int main()
{
int A[15] = {1,2,3,-1,-2,-3,1,2,-1,-2,1,2,3,4,5};
int k = 0;
for (int i=0; i<15; i++)</em>
k+=(A[i]<0) ? 1:0;</em>
std::cout <<(k/15*100) <<'\n';</em>
return 0;
}
2)
#include
int main()
{
int A[20] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,33,20};
for (int i=0; i<20; i++)</em>
if (A[i]%10==3)
std::cout <<A[i] <<std::endl;</em>
return 0;
}
3)
#include
int main()
{
int A[13] = {1,2,3,4,5,6,7,8,9,10,11,12,13};
usnigned int p = 1;
for (int i=0; i<13; i++)</em>
p*=(A[i]>9 && A[i]<100) ? A[i]:1;</em>
std::cout <<p <<'\n';</em>
return 0;
}
4)
#include
int main()
{
int A[30] = {1,2,3,4,5,6,7,8,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,
23 24 25 26,27,28,29,28};
bool flag = true;
for (int i=0; i<29; i++)</em>
if (a[i]>a[i+1])
{
flag = false;
break;
}
std::cout <<std::boolalpha <<flag <<std::endl;</em>
return 0;
}