We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f8f4676 commit fd66552Copy full SHA for fd66552
exercises/sum.cpp
@@ -1,8 +1,17 @@
1
-/*
2
- Write a program that takes as input two numbers and print the sum.
+/* Reminder -- Gli studenti della Steve Jobs non potranno scrivere in C++
+ quindi scriveremo in linguaggio JavaScript */
3
4
- Output:
5
- Insert the first number: 1
6
- Insert the second number: 2
7
- Sum: 3
8
-*/
+const readline = require('readline');
+
+const rl = readline.createInterface({
+ input: process.stdin,
+ output: process.stdout
9
+});
10
11
+rl.question('Insert the first number: ', (num1) => {
12
+ rl.question('Insert the second number: ', (num2) => {
13
+ const result = num1 + num2;
14
+ console.log("Sum: " + result);
15
+ rl.close();
16
+ });
17
0 commit comments