/*
מציאת המספר הכי גדול מבין שני מערכים
*/
int num1[4] = {10, 20, 30, 60};
int num2[4] = {9, 21, 29, 50};
int Max = -999;
void setup() {
Serial.begin(9600);
for (int i = 0; i < 4; i++) {
if (Max < num1[i]) {
Max = num1[i];
}
}
for (int j = 0; j < 4; j++) {
if (Max < num2[j]) {
Max = num2[j];
}
}
Serial.print("The largest number is:");
Serial.println(Max);
}
void loop() {
// put your main code here, to run repeatedly:
}
Comments