From b8e30c8bb04c11ccaa31b6e89a452ee66d372b0b Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Mon, 15 May 2017 18:04:14 +0200 Subject: fixed spaces --- cpp/somme.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'cpp') diff --git a/cpp/somme.cpp b/cpp/somme.cpp index e42ad64..df8f8ee 100644 --- a/cpp/somme.cpp +++ b/cpp/somme.cpp @@ -6,22 +6,16 @@ output: 1 #include #include -bool pari(int n) -{ - return ((n % 2) == 0) ? true : false; -} +bool pari(int n) { return ((n % 2) == 0) ? true : false; } int sequenza(int n, bool pollatz, int tCollatz = -1) { - int m; + int m, tot = 1; if(pollatz) m = 5; else m = 3; - - int tot = 1; - while(n != 1) { if(pari(n)) @@ -29,12 +23,10 @@ int sequenza(int n, bool pollatz, int tCollatz = -1) else n = n*m+1; - tot++; if(tCollatz != -1 && tot > tCollatz) break; - } return tot; -- cgit v1.2.3-18-g5258