Правые корабли уплывают вниз тем временем левые двигаются вперед
1)
#include <iostream>
using namespace std;
void draw_square(int n)
{
for(int y = 0; y < n; y++)
{
for (int x = 0; x < n; x++)
cout << "*";
cout << endl;
}
}
int main()
{
int n;
cin >> n;
draw_square(n);
return 0;
}
2)
#include <iostream>
using namespace std;
void drawNumbers(int a)
{
while(a > 0)
{
cout << a%10 << endl;
a /= 10;
}
}
int main()
{
int a;
cin >> a;
drawNumbers(a);
return 0;
}
3)
#include <iostream>
using namespace std;
int main()
{
//можно гораздо быстрей, но мне лень
int a;
cin >> a;
for(int i = 1; i <= a; i++) if(a%i==0) cout << i << " ";
return 0;
}
4)
#include <iostream>
using namespace std;
void procedure(int a)
{
int b = a;
int c = 1;
while(b > 0) {c *= 10; b/=10;}
while(c > 1)
{
cout << (a%c)/(c/10) << endl;
c /= 10;
}
}
int main()
{
int a;
cin >> a;
procedure(a);
return 0;
}<span>
</span>
А) 17 + 83 = 100
36 + 64 = 100
77 + 33 = 100
б) 21 + 7 = 28
36 - 12 = 28
99 - 71 = 28