Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


a number is perfect if it is equal to the sum of its proper
divisor..

6 is perfect number coz its proper divisors are 1,2 and
three.. and 1+2+3=6...

a number is deficient if the sum of its proper divisor is
less than the number..
sample: 8 is deficient, coz its proper divisors are 1,2 and
4, and 1+2+4=7.

abundant number, if the sum of its proper divisor is greater
than the number..
sample..12 is abundant coz 1+2+3+4+6=16 which is geater than 12.

now write a program that prompts the user for a number, then
determines whether the number is perfect,deficient and
abundant..



a number is perfect if it is equal to the sum of its proper divisor.. 6 is perfect number coz i..

Answer / samim

#include<conio.h>
#include<stdio.h>
int f(int x)
{ int i,c,a=0;
for(i=1;i<x;i++)
{ c=x%i;
if(c==0)
a+=i;
}
return a;
}
void main()
{ int x;
clrscr();
printf("\nenter a integer number:\n");
scanf("%d",&x);
printf("%d",f(x));
if(f(x)==x)
printf("\nthis number is prefect");
if(f(x)>x)
printf("\nthis number is abundant");
if(f(x)<x)
printf("\nthis number is deficient");
getch();
}

Is This Answer Correct ?    5 Yes 5 No

Post New Answer

More C Interview Questions

what is the output of following question? void main() { int i=0,a[3]; a[i]=i++; printf("%d",a[i] }

3 Answers  


a c code by using memory allocation for add ,multiply of sprase matrixes

0 Answers  


What is Bitwise Operator and how it works?

1 Answers  


write program on arrays

3 Answers   GE, Polycab,


Is there sort function in c?

0 Answers  


code for replace tabs with equivalent number of blanks

0 Answers   Bosch,


What are different storage class specifiers in c?

0 Answers  


Are pointers integers in c?

0 Answers  


Is null a keyword in c?

0 Answers  


EXPLAIN #INCLUDE<STDIO.H> EXPLAIN #INCLUDE<CONIO.H>

4 Answers  


What is the difference between null pointer and the void pointer?

3 Answers  


if a five digit number is input through the keyboard, write a program to calculate the sum of its digits. (hint:-use the modulus operator.'%')

23 Answers  


Categories