#include #define N 100 #include #include #include using namespace std; /* run this program using the console pauser or add your own getch, system("pause") or input loop */ bool CheckSumEqPrd(int n){ // Kiem tra tong bang tich int S=0,I=1; for(int x=n,r;x>0;x=x/10){ r=x%10; S=S+r; I=I*r; } if(S==I) return true; else return false; } int SearchSumEqPrd(int a[], int size){//Tim chi so phan tu co tong bang tich, tim k ra return -1 for(int i=0;i=N) return false; cout<<"\n"; for(int i=0;i>n; } } int SumNoNegArr(const int a[],int n){// Tinh tong cac phan tu khong am int S=0; for(int i=0;i=0) S=S+a[i]; } return S; } int SumDivisibleBy3(const int a[],int n){//Tong cac phan tu chia het cho 3 int S=0; for(int i=0;i0;n=n/10){ r=n%10; } if(r%2!=0) return true; } int Sum1thDigOdd(const int a[],int n){//Tinh tong cac so co chu so dau tien le int S=0; for(int i=0;i=1){ if(a[n-1]>=0) { return a[n-1]+RcrSumNoNegArr(a,n-1);} else return RcrSumNoNegArr(a,n-1);} else return 0; } int RcrSumDivisibleBy3(const int a[],int n){// De quy tinh tong cac phan tu cua mang chia het cho 3 if(n>=1){ if(a[n-1]%3==0) { return a[n-1]+RcrSumDivisibleBy3(a,n-1);} else return RcrSumDivisibleBy3(a,n-1);} else return 0; } int RcrSum1thDigOdd(const int a[],int n){// De quy tinh tong cac phan tu cua mang chia het cho 3 if(n>=1){ if(Check1thDigOdd(a[n-1])) { return a[n-1]+RcrSum1thDigOdd(a,n-1);} else return RcrSum1thDigOdd(a,n-1);} else return 0; } bool CheckSqrNum(int n){ //Kiem tra so chinh phuong if(sqrt(n)==(int)sqrt(n)) return true; else false; } int SumSqrNumArr(const int a[],int n){// Tinh tong cac phan tu la so chinh phuong cua mang int S=0; for(int i=0;i