XMPP JavaScript Library

Program to check whether given number is a perfect number or not

A number is a perfect number if it is equal to sum of all of it's positive divisors excluding itself

1 /*Programme to check whether a given number is a perfect number or not*/
2 #include <stdio.h>
3 #include <conio.h>
4 void main()
5 {
6 int num,i,sum=0;
7
8 printf("Enter a Number to chech it's perfection and 0 to quit: ");
9 scanf("%d",&num);
10
11 /*If vlaue entered by user is greater than 0 then continue else exit*/
12 while(num!=0)
13 {
14 /*Calculate the sum of all the positive divisors*/
15 for(i=1; i<num; i++)
16 {
17 if(num%i==0)
18 {
19 printf("%d + ",i);
20 sum=sum+i;
21 }
22 }
23 /*Check if the sum=num*/
24 if(num==sum)
25 {
26 printf("= %d",sum);
27 printf("Perfet Number");
28 }
29 else
30 {
31 printf("= %d",sum);
32 printf("Not a perfet Number");
33 }
34 sum=0;
35 printf("Enter a Number to chech it's perfection and 0 to quit: ");
36 scanf("%d",&num);
37 }
38 }
39
Add Your Comment
   
    Yes! I want to receive all comments by email

  by cheap_cialis on 16-Feb-2019 11:23 pm
  • Reply
  •  0 Like
  •  0 Dislike
  • Report
  by buy_cialis on 14-Feb-2019 05:13 am
  • Reply
  •  0 Like
  •  0 Dislike
  • Report
  by viagra_cheap on 30-Jan-2019 06:56 pm
  • Reply
  •  0 Like
  •  0 Dislike
  • Report
  by cialis_cheap on 30-Jan-2019 02:07 pm
  • Reply
  •  0 Like
  •  0 Dislike
  • Report
  by buy_viagra on 25-Jan-2019 11:39 pm
  • Reply
  •  0 Like
  •  0 Dislike
  • Report
  by buy_cialis on 21-Jan-2019 12:36 am
  • Reply
  •  0 Like
  •  0 Dislike
  • Report
  by cialis on 20-Jan-2019 08:01 pm
  • Reply
  •  0 Like
  •  0 Dislike
  • Report
  by Dote B on 15-Jan-2019 11:40 pm
  • Reply
  •  0 Like
  •  0 Dislike
  • Report
  by viagra on 15-Jan-2019 11:40 pm
  • Reply
  •  0 Like
  •  0 Dislike
  • Report
  by Dote B on 15-Jan-2019 11:39 pm
happy day 2019 [url=https://google.com/]happy valentines day 2019[/url]
  • Reply
  •  0 Like
  •  0 Dislike
  • Report
  by online_viagra on 15-Jan-2019 03:36 am
  • Reply
  •  0 Like
  •  0 Dislike
  • Report
  by viagra_online on 01-Jan-2019 06:15 am
  • Reply
  •  0 Like
  •  0 Dislike
  • Report
  by cialis on 31-Dec-2018 10:57 pm
  • Reply
  •  0 Like
  •  0 Dislike
  • Report
  by viagra on 31-Dec-2018 10:05 am
  • Reply
  •  0 Like
  •  0 Dislike
  • Report
  by viagra on 11-Dec-2018 03:28 pm
  • Reply
  •  0 Like
  •  0 Dislike
  • Report
  by cialis on 10-Dec-2018 10:41 am
  • Reply
  •  0 Like
  •  0 Dislike
  • Report
  by viagra_buy on 01-Dec-2018 10:36 pm
  • Reply
  •  0 Like
  •  0 Dislike
  • Report
  by viagra on 21-Nov-2018 06:14 am
  • Reply
  •  0 Like
  •  0 Dislike
  • Report
  by buy_cialis on 09-Nov-2018 08:42 am
  • Reply
  •  0 Like
  •  0 Dislike
  • Report
  by generic on 07-Nov-2018 07:02 am
  • Reply
  •  0 Like
  •  0 Dislike
  • Report
  by generic_cialis on 01-Nov-2018 12:43 pm
  • Reply
  •  0 Like
  •  0 Dislike
  • Report
  by shilakant jha on 18-Aug-2012 01:06 pm
thanks
  • Reply
  •  1 Like
  •  3 Dislike
  • Report
  by Hari Prakash Tiwari on 13-Jun-2012 12:39 pm
nice programing concept.clear and neat post
  • Reply
  •  5 Like
  •  4 Dislike
  • Report

Warning: include(ads/adbrite_300_250.php): failed to open stream: No such file or directory in /home2/sachinpu/public_html/pages/algorithm.php on line 33

Warning: include(ads/adbrite_300_250.php): failed to open stream: No such file or directory in /home2/sachinpu/public_html/pages/algorithm.php on line 33

Warning: include(): Failed opening 'ads/adbrite_300_250.php' for inclusion (include_path='.:/opt/cpanel/ea-php56/root/usr/share/pear') in /home2/sachinpu/public_html/pages/algorithm.php on line 33

About the author

Sachin Puri Hi, I am Sachin Puri, I am a Programmer. Programming is my work and it is the thing i like to do most in my free time.
You can catch Sachin Puri at