gabbyshimoni

findMax

Jan 14th, 2017
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. void setup() {
  2.   int nitzav1 = 3;
  3.   int nitzav2 = 4;
  4.   int yeter = 5;
  5.   int max;
  6.   Serial.begin(9600);
  7.   if (yeter > nitzav1) {
  8.     if (yeter > nitzav2) {
  9.       max = yeter;
  10.     }
  11.     else {
  12.       max = nitzav2;
  13.     }
  14.   }
  15.   else {
  16.     if (nitzav1 > nitzav2) {
  17.       max = nitzav1;
  18.     }
  19.     else {
  20.       max = nitzav2;
  21.     }
  22.   }
  23.   Serial.print("The longest side is:");
  24.   Serial.println(max);
  25. }
  26. void loop() {
  27. }
Advertisement
Add Comment
Please, Sign In to add comment