This content originally appeared on DEV Community and was authored by Tony
Viral Math Problems: 6 / 2 * (1 + 2)
How do computers solve - 6 / 2 * (1 + 2) ?
The answer is 9.
Code & Repo for current solutions
C answer - 9
code:
#include "stdio.h"
int main() {
int a = 6 / 2 * ( 1 + 2);
printf("C answer - %d\n", a);
return 0;
}
Golang answer - 9
code:
package main
import "fmt"
func main() {
a := 6 / 2 * (1 + 2)
fmt.Printf("Golang answer - %d\n", a)
}
Node.JS answer - 9
code:
const a = 6 / 2 * (1 + 2)
console.log(`Node.JS answer - ${a}`)
Deno answer - 9
code:
const a = 6 / 2 * (1 + 2)
console.log(`Deno answer - ${a}`)
Python2 answer - 9
code:
a = 6 / 2 * ( 1 + 2)
print("Python2 answer - " + str(a))
Python3 answer - 9.0
code:
a = 6 / 2 * ( 1 + 2 )
print("Python3 answer - " + str(a))
Ruby answer - 9
code:
a = 6 / 2 * (1 + 2)
puts "Ruby answer - #{a}"
This content originally appeared on DEV Community and was authored by Tony
Print
Share
Comment
Cite
Upload
Translate
Updates
There are no updates yet.
Click the Upload button above to add an update.
APA
MLA
Tony | Sciencx (2021-04-19T18:23:26+00:00) Viral Math Problems: 6 / 2 * (1 + 2). Retrieved from https://www.scien.cx/2021/04/19/viral-math-problems-6-2-1-2/
" » Viral Math Problems: 6 / 2 * (1 + 2)." Tony | Sciencx - Monday April 19, 2021, https://www.scien.cx/2021/04/19/viral-math-problems-6-2-1-2/
HARVARDTony | Sciencx Monday April 19, 2021 » Viral Math Problems: 6 / 2 * (1 + 2)., viewed ,<https://www.scien.cx/2021/04/19/viral-math-problems-6-2-1-2/>
VANCOUVERTony | Sciencx - » Viral Math Problems: 6 / 2 * (1 + 2). [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/04/19/viral-math-problems-6-2-1-2/
CHICAGO" » Viral Math Problems: 6 / 2 * (1 + 2)." Tony | Sciencx - Accessed . https://www.scien.cx/2021/04/19/viral-math-problems-6-2-1-2/
IEEE" » Viral Math Problems: 6 / 2 * (1 + 2)." Tony | Sciencx [Online]. Available: https://www.scien.cx/2021/04/19/viral-math-problems-6-2-1-2/. [Accessed: ]
rf:citation » Viral Math Problems: 6 / 2 * (1 + 2) | Tony | Sciencx | https://www.scien.cx/2021/04/19/viral-math-problems-6-2-1-2/ |
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.