List of all available Websheets
Viewing cpp/division-modulo/kilograms by redekopp@usc.edu. You have unsaved changes. Log in above to create, edit, preview and publish Websheets.
Property | Value |
---|---|
Description html markup shown to student | Given a number in grams, convert to the equivalent number of kilograms and grams |
Public permissions | |
Remarks Comments, history, license, etc. | Copied from problem cpp/division-modulo/building-floor (author: redekopp@usc.edu) Copied from problem cpp/cin/building_floor (author: redekopp@usc.edu) Copied from problem cpp/cin/average (author: redekopp@usc.edu) Copied from problem cpp/var-expr/in_n_days (author: redekopp@usc.edu) Copied from problem cpp/var-expr/char_arith (author: redekopp@usc.edu) Copied from problem cpp/var-expr/hello (author: daveagp@gmail.com) |
Engine | |
Template / Reference solution |
using namespace std; int main() { // variable for the number of grams \[ int grams; ]\ cout << "Enter the number of grams: " << endl; \[ cin >> grams; ]\ cout << "Kilograms = " << \[ grams / 1000 ]\ << " and remaining grams = " << grams % 1000 << endl; return 0; } |
C++ test suite json list of stdin/args tests e.g. [{"stdin":"hi", "args":["4", "5"]}, {"stdin":"noargs"}] to just run once with no input use [{}] | [ {"stdin":"57632", "args":[]}, {"stdin":"2236", "args":[]}, {"stdin":"10499", "args":[]}, {"stdin":"100", "args":[]} ] |
Solution visibility |
Note: problems are open-source by default (see 'Public permissions'). Assumed license for open problems is Creative Commons 4.0 Attribution-ShareAlike unless specified in 'Remarks'.