fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6. int a[5]={2,4,7,1,5};
  7. int b[3]={5,4,2};
  8. int count=0;
  9. for(int i=0;i<5;i++){
  10. for(int j=0;j<3;j++){
  11. if(b[j]==a[i]){
  12. count++;
  13. }
  14. }
  15. }
  16. if(count==3){
  17. cout<<"There exits a subset";
  18. }
  19. else{
  20. cout<<"there does not exit a subset";
  21. }
  22. return 0;
  23. }
Success #stdin #stdout 0.01s 5280KB
stdin
Standard input is empty
stdout
There exits a subset