Division, Remainder - Practice

Muhammad Magdi

#include <iostream>

using namespace std;

int main() {
  int sec;
  cin >> sec;
  int hours = sec / (60*60);
  int rem = sec % (60*60);
  int min = rem / 60;
  cout << hours << ":" << min << ":" << rem%60 << endl;
}
#include <iostream>
#include <cmath>

using namespace std;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  int maxAB = (a + b + abs(a - b)) / 2;
  int maxABC = (maxAB + c + abs(maxAB - c)) / 2;
  cout << maxABC << " eh o maior" << endl;
  return 0;
}

Assignment

Thanks

Content

  • Time Conversion
  • The Greatest
  • Assignment
Made with Slides.com