There was an error while loading. Please reload this page.
1 parent 7fee6ff commit ad66576Copy full SHA for ad66576
determining perfect number using functions
@@ -0,0 +1,33 @@
1
+#include <stdio.h>
2
+int func(int a){
3
+ int sum=0;
4
+
5
+ for(int i=1;i<a;i++){
6
+ if(a%i==0){
7
8
+ sum=sum+i;
9
+ }
10
11
12
13
+ if(sum==a){
14
+ printf("perfect");
15
16
+ else{
17
+ printf(" not perfect");
18
19
20
21
22
23
+int main()
24
+{
25
26
+ int n;
27
+ printf("enter the number to find it is perfect or not : ");
28
+ scanf("%d",&n);
29
+ func(n);
30
31
32
+ return 0;
33
+}
0 commit comments