Advertisement
gabbyshimoni

arrayExample09

Jun 2nd, 2018
346
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | None | 0 0
  1. /*
  2.   הגדרת שני מערכי מספרים ומציאת המספרים הכי גדולים באותו מיקום במערך
  3. */
  4.  
  5. int num1[4] = {10, 20, 30, 40};
  6. int num2[4] = {9, 21, 29, 50};
  7. void setup() {
  8.   Serial.begin(9600);
  9.   for (int i = 0; i < 4; i++) {
  10.     if (num1[i] > num2[i]) {
  11.       Serial.print(i);
  12.       Serial.print(" : ");
  13.       Serial.println(num1[i]);
  14.     }
  15.     else {
  16.       Serial.print(i);
  17.       Serial.print(" : ");
  18.       Serial.println(num2[i]);
  19.     }
  20.   }
  21. }
  22.  
  23. void loop() {
  24.   // put your main code here, to run repeatedly:
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement