Advertisement
syad28

UITM CS128 Tutorial Q12

Feb 14th, 2016
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.35 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int number,exact=0;
  8.     cout<<"Enter number : ";
  9.     cin>>number;
  10.     for(int i=1;i<number;i++){
  11.         if(number%i==0)
  12.             exact+=i;
  13.     }
  14.  
  15.     if(exact==number)
  16.         cout<<"\nIt is exact number";
  17.         else
  18.             cout<<"\nIt is not an exact number";
  19.  
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement