From 33af96f9a968513b893be3bc3dcf67a16461e32f Mon Sep 17 00:00:00 2001 From: Maxank-Bisht <54896660+Maxank-Bisht@users.noreply.github.com> Date: Fri, 2 Oct 2020 10:39:14 +0530 Subject: [PATCH] Update main.cpp --- .../main.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Lesson 1/Activity 1 - Find the Factors of 7 between 1 and 100 using while Loop/main.cpp b/Lesson 1/Activity 1 - Find the Factors of 7 between 1 and 100 using while Loop/main.cpp index ca20afd..1d20ee8 100644 --- a/Lesson 1/Activity 1 - Find the Factors of 7 between 1 and 100 using while Loop/main.cpp +++ b/Lesson 1/Activity 1 - Find the Factors of 7 between 1 and 100 using while Loop/main.cpp @@ -2,12 +2,16 @@ int main() { - unsigned i = 1; - while ( i <= 100) { - if (i%7 == 0) { - std::cout << i << std::endl; - } - i++; +// unsigned i = 1; +// while ( i <= 100) { +// if (i%7 == 0) { +// std::cout << i << std::endl; +// } +// i++; +// } + for(int i=0; i<100; i+=7){ //this will reduce the time complexity of the program. + std::cout<< i << std::endl; } + -} \ No newline at end of file +}