0
The symbol s and the natural number n are given. Print a square of s characters with size n x n.
The symbol s and the natural number n are given. Print a square of s characters with size n x n.
11 ответов
0
Copy your code to code Playground, then you can try yourself. You need closing brackets and cast to integer. Output must be in inner loop. Use j instead of i for inner loop.
You are on the right track, keep going
+ 1
thank you ❤️❤️❤️ i did it!!!
+ 1
#include <iostream>
using namespace std;
int main() {
char s;
cin » s;
int N,M;
cin » N»M;
for (int i = 0; i < N; i++) {
for (int j = 0; j < M; j++) {
cout « s;
}cout « endl;
}
}
0
Did you try it? Show us and say where you are stuck
0
i couldnt do it
0
Do it like this:
A for loop that prints s n times
That gives you one line
Another for loop around that that also loops n times
That will give you n lines of n characters s
0
char s[];
int n;
cin>>n;
for(int i=0;i<n;i++){
cin>>s[i];}
like this ? what should i do next?
0
N is int, so cast input to int
S should be single char, no brackets
Read s from input, cin>>s;
In loop use output (cout)
Add another loop around the first
0
int N;
cin>>N;
char s;
cin>>s;
for(int i=0;i<N;i++){
cout<<s;
for(int i=0;i<N;i++){
0
Given the symbol s and the natural numbers n, m. Print a rectangular frame of s characters with size n x m.
0
how to create a rectangle frame? should i change for loop?this code creates just rectangle