Friday, September 1, 2023

This program builds a square from asterisks

 // This program builds a square from asterisks  

#include <iostream>

#include <string>

using namespace std;

int main()

{

    int N;

cout <<"What is size of the square?";

cin >> N;

    

for(int i=1;i<=N; i++)cout <<"*"; cout <<endl;

for(int i=1;i<=N-2; i++)

{cout <<"*";for(int i=1;i<=N-2; i++)cout <<" ";cout <<"*"<<endl;}

for(int i=1;i<=N; i++)cout <<"*"; cout <<endl;


    return 0;

}

No comments:

Post a Comment

NaCl.xyz Generator with Interactive 3D Visualization

NaCl.xyz Generator with Interactive 3D Visualization NaCl.xyz Generator with Interactive 3D Visualization ...