1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Qiita100万記事感謝祭!記事投稿キャンペーン開催のお知らせ

paizaラーニングレベルアップ問題集の「代入演算1」をやってみた。

Posted at

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
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?