Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int value = 0;
- cout << "Enter a number between 1 & 20: ";
- //scanf(%d , &value); //c
- cin >> value; //c++
- int i = 0; int j = 0;
- for(i = 0; i < value; i++)
- {
- for(j = 0; j < value; j++)
- {
- if( i==0 || i == (value-1) || j==0 || j== (value-1)) // ||- logical or //if j is first or last value, print * //if checks for true false in statement
- {
- cout <<"* ";
- }
- else //this will happen if it is either not 1st value or last value
- {
- cout << " ";
- }
- }
- cout << endl;
- }
- cout << endl; //cout << "\n"
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement