Você está na página 1de 2

#include <iostream>

/* run this program using the console pauser or add your own getch,
system("pause") or input loop */
using namespace std;

int main(int argc, char** argv) {

while(1){

int i,num_dig=0,soma=0;
system("cls");
system("color 07");
cout<<"\t\t**********************************************
**********\n"
"\t\t******************* DIGITE UM NUMERO
*******************\n"

"\t\t********************************************************\
n";
cin>>num_dig;
if(num_dig!=0 && num_dig>=1){

//*************** MOSTRAR OS SEUS DIVISORES ****************


cout<<"\t\t SEUS DIVISORES SAO: ";
for(i=1; i<=num_dig/2; i++){

if(num_dig % i == 0){
cout<<" "<<i;

// ************* SOMAR OS DIVISORES ****************


soma=soma+i;
}
}cout<<"\n";

// ************* MOSTRAR DIVISORES E DIZER SE E PERFEITO


***********

if (soma != num_dig){
system("color 47");
cout<<"\t\t SOMA = "<<soma<<" O NUMERO NAO E
PERFEITO\n\n";
}else {
system("color 27");
cout<<"\t\t SOMA = "<<soma<<" O NUMERO E
PERFEITO\n\n";
}system("pause");
}
// ************** CASO DIGITAR UM NUMERO NEGATIVO
***************
else {
cout<<"\t\t APENAS NUMEROS POSITIVOS E MAIOR QUE 0\n";
system("pause");}
}
return 0;
}

Você também pode gostar