A practice problem for understanding control flow (for loops, while loops, if-else statements).
// This website takes input-output from file instead // of standard input output like most competitive // programming websites. Hence, here's a skeleton code // (C++ only) to get you started #include <cstdio> #include <iostream> using namespace std; int main() { freopen("INPUT_FILE_NAME.txt", "r", stdin); freopen("OUTPUT_FILE_NAME.txt", "w", stdout); /* ... your code here ... */ /* ... cin, cout will work normally. example ... */ /* ... int a, b; cin >> a >> b; ... */ return 0; }
Feel free to ask questions if you get stuck.