Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int a[20];
- int max=a[0];
- int imax=-1;
- cout << "Enter elementi massiva: " << endl;
- for ( int i = 0; i < 20; i++ )
- {
- cin >> a[i];
- if (a[i]==0)
- {
- i=19;
- }
- imax++;
- }
- for (int i=0; i<imax; i++)
- {
- if (a[i] > max)
- {
- max = a[i];
- }
- }
- for (int i=0; i<imax; i++)
- {
- int c;
- int d;
- c=(max-a[i])/2+0.5;
- while (c>0)
- {
- cout << " ";
- c--;
- }
- d=0;
- while (d<(a[i]))
- {
- cout << "*";
- d++;
- }
- cout<< endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement