eolymp
bolt
Спробуйте наш новий інтерфейс для відправки розв'язків
Задачі

Шаблон 3

опубліковано 02.01.24, 20:40:52

include <bits/stdc++.h>

using namespace std; int main() { long long n; cin>>n; for(int i=0;i<n;i++) { for(int j=0;j<n;j++) { if(i==j || i+j==n-1) cout<<"*"; else cout<<" "; } cout<<endl; } }

опубліковано 04.04.24, 17:42:26

include <bits/stdc++.h>

using namespace std; class Ulduz{ public: int n; void Ulduzinfo(){ for(int i=1 ;i<=n; i++){ for(int j=1 ;j<=n ;j++){ if(i+j==n+1 || i==j){ cout << "*"; } else{ cout << " "; } } cout << endl; } } }; int main(){ int n; cin >> n; Ulduz u; u.n=n; u.Ulduzinfo(); }