From 774e2d9aa97bbaf4dd3d650d3d75c3aeb81a6cf0 Mon Sep 17 00:00:00 2001 From: divyalakhwani31 <34311805+divyalakhwani31@users.noreply.github.com> Date: Mon, 28 Oct 2019 20:36:22 +0530 Subject: [PATCH] Update willitst.cpp --- c++/willitst.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/c++/willitst.cpp b/c++/willitst.cpp index 42376f3..b09a6bc 100755 --- a/c++/willitst.cpp +++ b/c++/willitst.cpp @@ -5,16 +5,22 @@ using namespace std; int main() { long long int n; cin>>n; - if(n==1) + + if(n == 1) cout<<"TAK"; + else - while(n%2==0&&n>0) + while(n%2 == 0 && n > 0) { - n/=2; - if(n==1) - {cout<<"TAK"; - break;} - }if(n>1)cout<<"NIE"; + n /= 2; + if(n == 1) + { + cout<<"TAK"; + break; + } + } + if(n > 1) + cout<<"NIE"; return 0; }