paizaラーニングレベルアップ問題集の代入演算1をやってみました。
問題
C
#include <stdio.h>
int main() {
int n = 0;
n += 3286;
n *= 4736;
n %= 12312;
printf("%d\n", n);
return 0;
}
C++
#include <iostream>
using namespace std;
int main() {
int n = 0;
n += 3286;
n *= 4736;
n %= 12312;
cout << n << endl;
return 0;
}
C#
using System;
class Program
{
public static void Main()
{
int n = 0;
n += 3286;
n *= 4736;
n %= 12312;
Console.WriteLine(n);
}
}
Go
package main
import "fmt"
func main() {
n := 0
n += 3286
n *= 4736
n %= 12312
fmt.Println(n)
}
Java
public class Main {
public static void main(String[] args) {
int n = 0;
n += 3286;
n *= 4736;
n %= 12312;
System.out.println(n);
}
}
JavaScript
let n = 0;
n += 3286;
n *= 4736;
n %= 12312;
console.log(n);
Kotlin
fun main() {
var n = 0
n += 3286
n *= 4736
n %= 12312
println(n)
}
PHP
<?php
$n = 0;
$n += 3286;
$n *= 4736;
$n %= 12312;
echo $n, PHP_EOL;
?>
Perl
my $n = 0;
$n += 3286;
$n *= 4736;
$n %= 12312;
print "$n$/";
Python3
n = 0
n += 3286
n *= 4736
n %= 12312
print(n)
Ruby
n = 0
n += 3286
n *= 4736
n %= 12312
p n
Scala
object Main extends App{
var n = 0
n += 3286
n *= 4736
n %= 12312
println(n)
}
Swift
var n = 0
n += 3286
n *= 4736
n %= 12312
print(n)
出力結果
128