This repository has been archived on 2024-10-24. You can view files and clone it, but cannot push or open issues or pull requests.
NG_2024_Stanislav_Mykhailenko/Lesson_2/Task_2/main.cpp
Stanislav Mykhailenko a9b7ecf20c
Add Lesson 2
2024-06-24 18:19:29 +03:00

29 lines
726 B
C++

#include <iostream>
using namespace std;
int main()
{
int numbers[20];
int maximum = 0;
for (int number = 0; number < 20; ++number) {
cout << "Enter value: ";
cin >> numbers[number];
if (maximum < numbers[number])
maximum = numbers[number];
if (numbers[number] == 0)
break;
}
for (int number = 0; number < 20; ++number) {
if (numbers[number] == 0)
break;
int spaces = (maximum - numbers[number]) / 2;
for (int space = 0; space < spaces; ++space)
cout << " ";
for (int asterisk = 0; asterisk < numbers[number]; ++asterisk)
cout << "*";
cout << endl;
}
return 0;
}