It's very easy:
Create a program without writing a single line of code. The code may only consist of existing Stack Overflow questions and answers.
The program should create two random numbers and output the numbers
- added to,
- subtracted from,
- multiplied with and
- divided by
each other.
Rules
You must include links to the questions/answers you used in your answer. You may not modify the code you find, with the following exceptions:
You may rename variables, functions, and methods. (This doesn't mean you can change a method invocation, by changing, say scanner.nextInt() to scanner.nextLine() and claiming that you're changing a method name. The change must be in the definition or reference to the same entity.). The solution should still work if variables, functions or methods would be renamed again.
You may adjust indentation appropriately.
You can assume that the proper modules are loaded for the code snippets to work. (e.g., import statements for Java and Python, using statements for C# and C++, and their equivalents in all languages) If the code snippet includes the imports for you, you can move them to the top of the code.
If the language requires the code to be in some kind of method body to execute (e.g.,
public static void main(String[] args)
for Java,static int Main(string[] args)
for C#, and so on), you can wrap your code in the appropriate method. But the contents of that main method must remain unmodified.You must supply an explicit list of any variable/method/function/class renamings performed.
You can't take snippets of snippets (meaning if you take a code block from a post, you take the whole thing) Provide a brief description of what the code does for people who aren't intimate with the language you're using. You must use snippets posted before this challenge was started.
Popularity contest, so the most upvotes wins!
Deadline
I will accept the the submission that has the most votes around the end of August, 6.