Perfect Number Finder

 
Perfect Number Finder sample code.


Here is the code:

#include<stdio.h>
int main(){
  int n,i=1,toplam=0;

  printf("Mukemmel sayi olup olmadigini kontrol etmek istediginiz sayiyi girin\n");
  scanf("%d",&n);
  while(i<n){
      if(n%i==0)
           toplam=toplam+i;
          i++;
  }
  if(toplam==n)
      printf("%d sayisi mukemmel sayi\n",i);
  else
      printf("%d sayisi mukemmel sayi degil\n",i);

  return 0;
}

Comments

Popular posts from this blog