Facebook
From a, 3 Months ago, written in C++.
Embed
Download Paste or View Raw
Hits: 219
  1. #include<iostream>
  2. using namespace std;
  3.  
  4.  
  5.  
  6. int main(){
  7.  
  8.     int sum=0;
  9.  
  10.  
  11. int a[10]={4,6,12,24,28,32,36};
  12.  
  13. for (int j=0;j<7;j++){
  14.  
  15.    for (int i=1; i<=a[j]/2;i++){
  16.  
  17.     if ((a[j]% i)==0) {
  18.         sum=sum+i;
  19.  
  20.     }
  21.  
  22. }
  23.  
  24. if (a[j]==sum){
  25.  
  26.     cout<<"Correct"<<endl;
  27. }
  28. else{
  29.  
  30.     cout<<"Incorrect"<<endl;
  31. }
  32. sum=0;
  33.  
  34. }}
  35.