fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int data[10] = {1, 1, 3, 4, 3, 3, 3, 9, 1, 9};
  6. int hasil = 0;
  7. for (int i = 0; i < 9; i++) {
  8. if (data[i] == data[i+1]) {
  9. hasil++;
  10. }
  11. }
  12. cout << hasil << endl;
  13. }
Success #stdin #stdout 0.01s 5324KB
stdin
Standard input is empty
stdout
3