Skip to content

Instantly share code, notes, and snippets.

@modos
Created July 8, 2022 20:14
Show Gist options
  • Save modos/8e33f61d46bea7353594ec1711524a63 to your computer and use it in GitHub Desktop.
Save modos/8e33f61d46bea7353594ec1711524a63 to your computer and use it in GitHub Desktop.
کامل بودن یا نبودن
/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <iostream>
using namespace std;
int main()
{
long long int a, b, c, n;
cin>> n;
c = 0;
for(int i =1; i!=n; i++)
{
if(n % i == 0)
{
c += i;
}
}
if(c == n)
{
cout <<"YES";
}
else
{
cout<<"NO";
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment