From dff5a4f802aaacf907dd5868bdaa624d1c36ae60 Mon Sep 17 00:00:00 2001 From: Anmol Chandel Date: Wed, 7 Aug 2024 22:25:02 +0530 Subject: [PATCH] improved logic to check if a number is perfect --- Perfect Numbers/Check Perfect.c | 16 ++++++++-------- Perfect Numbers/Perfect Numbers.c | 19 ++++++++++--------- Perfect Numbers/Perfect Numbers.cpp | 20 +++++++++++--------- 3 files changed, 29 insertions(+), 26 deletions(-) diff --git a/Perfect Numbers/Check Perfect.c b/Perfect Numbers/Check Perfect.c index f5e24d54..0b895d93 100644 --- a/Perfect Numbers/Check Perfect.c +++ b/Perfect Numbers/Check Perfect.c @@ -2,15 +2,15 @@ #include int isPerfect(int num){ - int count=0; - for(int i=1;i +#include int isPerfect(int num){ - int count=0; - for(int i=1;i +#include using namespace std; int isPerfect(int num){ - int count=0; - for(int i=1;i