Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <iomanip>
- #include <cstdlib>
- using namespace std;
- int main (){
- int n, difference;
- cin >> n;
- for (int i = 1; i <= n; i ++){
- for (int j = 1; j <= n; j ++){
- if (i == j || j == n - i + 1 || n - i == n / 2 || n - j == n / 2){
- cout << "* ";
- }
- else{
- cout << ". ";
- }
- }
- cout << endl;
- }
- }
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main() {
- int n, m;
- cin >> n >> m;
- for (int i = 1; i <= n; i++){
- for (int j = 1; j <= m; j++){
- if ((j % 2 == 0 && i % 2 == 0) || (j % 2 == 1 && i % 2 == 1)) {
- cout << ". ";
- }
- else {
- cout << "* ";
- }
- }
- cout << endl;
- }
- }
- #include <iostream>
- #include <cmath>
- #include <iomanip>
- #include <cstdlib>
- using namespace std;
- int main (){
- int n;
- cin >> n;
- for (int i = 1; i <= n; i ++){
- for (int j = 1; j <= n; j ++){
- if (j <= n - i){
- cout << "0 ";
- }
- else if (j == n - i + 1){
- cout << "1 ";
- }
- else if (j > n - i + 1){
- cout << "2 ";
- }
- }
- cout << endl;
- }
- }
- #include <iostream>
- #include <cmath>
- #include <iomanip>
- #include <cstdlib>
- using namespace std;
- int main (){
- int n, difference;
- cin >> n;
- for (int i = 1; i <= n; i ++){
- for (int j = 1; j <= n; j ++){
- if (j == i){
- cout << "0 ";
- }
- else{
- cout << abs(j - i) << " ";
- }
- }
- cout << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement