From c1a80e1ffeebb69ca9fb579f10dd3cb1fd20b160 Mon Sep 17 00:00:00 2001 From: Aviral Aggarwal Date: Sun, 22 Oct 2017 15:23:56 +0530 Subject: [PATCH] Changed Loop. if you can always initialise values with 0 always do that as loops naturally starts with 0. Its just a small change but easier for others to understand. --- pattern1.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pattern1.cpp b/pattern1.cpp index 2f7d129..c4f9bdb 100644 --- a/pattern1.cpp +++ b/pattern1.cpp @@ -9,18 +9,20 @@ using namespace std; int main() { + int nRows; label: cout << "Enter number of rows you want to print: "; cin >> nRows; + if (nRows < 0) { cout << "Oops..Enter a positive number..!\n"; goto label; } - for (int i=1; i<=nRows; i++) { - for (int j=1; j<=i; j++) { + for (int i=0; i