Answers for "Verify that the number is complete or not"

C
1

Verify that the number is complete or not

#include <stdio.h>
int main(void) {
  int n,i,x;
  printf("enter the number:");
  scanf("%d",&n);
x=0;
for (i=1;i<n;i++){
if(n%i==0){
  x=x+i;
}

}
printf("the result is %s " ,(x==n)?"true":"false");
  return 0;
}
Posted by: Guest on July-03-2021

Code answers related to "Verify that the number is complete or not"

Code answers related to "C"

Browse Popular Code Answers by Language