paizaラーニングレベルアップ問題集の【比較演算子】をやってみた。

paizaラーニングレベルアップ問題集の【比較演算子】をやってみました。
- - -
##### 問題
###### STEP: 1 比較演算子：`==`
https://paiza.jp/works/mondai/conditions_expression/conditions_expression__comparison_operator_step1
###### STEP: 2 比較演算子：`!=`
https://paiza.jp/works/mondai/conditions_expression/conditions_expression__comparison_operator_step2
###### STEP: 3 比較演算子：`<`
https://paiza.jp/works/mondai/conditions_expression/conditions_expression__comparison_operator_step3
###### STEP: 4 比較演算子：`<=`
https://paiza.jp/works/mondai/conditions_expression/conditions_expression__comparison_operator_step4
###### STEP: 5 式の比較
https://paiza.jp/works/mondai/conditions_expression/conditions_expression__comparison_operator_step5
###### FINAL問題 文字列の比較
https://paiza.jp/works/mondai/conditions_expression/conditions_expression__comparison_operator_boss
- - -
##### C
###### STEP: 1 比較演算子：==
```c
#include <stdio.h>

int main() {
	int a, b;
	scanf("%d %d", &a, &b);
	printf("%d\n", a == b);
	return 0;
}
```
###### STEP: 2 比較演算子：!=
```c
#include <stdio.h>

int main() {
	int a, b;
	scanf("%d %d", &a, &b);
	printf("%d\n", a != b);
	return 0;
}
```
###### STEP: 3 比較演算子：<
```c
#include <stdio.h>

int main() {
	int a, b;
	scanf("%d %d", &a, &b);
	printf("%d\n", a < b);
	return 0;
}
```
###### STEP: 4 比較演算子：<=
```c
#include <stdio.h>

int main() {
	int a, b;
	scanf("%d %d", &a, &b);
	printf("%d\n", a <= b);
	return 0;
}
```
###### STEP: 5 式の比較
```c
#include <stdio.h>

int main() {
	int a, b, c, d;
	scanf("%d %d %d %d", &a, &b, &c, &d);
	printf("%d\n", a + b == c * d);
	return 0;
}
```
###### FINAL問題 文字列の比較
```c
#include <stdio.h>
#include <string.h>

int main() {
	char s[21], t[21];
	scanf("%s %s", s, t);
	printf("%d\n", strcmp(s, t) == 0);
	return 0;
}
```
- - -
##### C++
###### STEP: 1 比較演算子：==
```cpp
#include <iostream>
using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	cout << (a == b) << endl;
	return 0;
}
```
###### STEP: 2 比較演算子：!=
```cpp
#include <iostream>
using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	cout << (a != b) << endl;
	return 0;
}
```
###### STEP: 3 比較演算子：<
```cpp
#include <iostream>
using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	cout << (a < b) << endl;
	return 0;
}
```
###### STEP: 4 比較演算子：<=
```cpp
#include <iostream>
using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	cout << (a <= b) << endl;
	return 0;
}
```
###### STEP: 5 式の比較
```cpp
#include <iostream>
using namespace std;

int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	cout << (a + b == c * d) << endl;
	return 0;
}
```
###### FINAL問題 文字列の比較
```cpp
#include <iostream>
using namespace std;

int main() {
	string s, t;
	cin >> s >> t;
	cout << (s == t) << endl;
	return 0;
}
```
- - -
##### C#
###### STEP: 1 比較演算子：==
```cs
using System;

class Program
{
	public static void Main()
	{
		int[] ab = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
		int a = ab[0];
		int b = ab[1];
		Console.WriteLine(a == b);
	}
}
```
###### STEP: 2 比較演算子：!=
```cs
using System;

class Program
{
	public static void Main()
	{
		int[] ab = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
		int a = ab[0];
		int b = ab[1];
		Console.WriteLine(a != b);
	}
}
```
###### STEP: 3 比較演算子：<
```cs
using System;

class Program
{
	public static void Main()
	{
		int[] ab = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
		int a = ab[0];
		int b = ab[1];
		Console.WriteLine(a < b);
	}
}
```
###### STEP: 4 比較演算子：<=
```cs
using System;

class Program
{
	public static void Main()
	{
		int[] ab = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
		int a = ab[0];
		int b = ab[1];
		Console.WriteLine(a <= b);
	}
}
```
###### STEP: 5 式の比較
```cs
using System;

class Program
{
	public static void Main()
	{
		int[] abcd = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
		int a = abcd[0];
		int b = abcd[1];
		int c = abcd[2];
		int d = abcd[3];
		Console.WriteLine(a + b == c * d);
	}
}
```
###### FINAL問題 文字列の比較
```cs
using System;

class Program
{
	public static void Main()
	{
		string[] st = Console.ReadLine().Split();
		string s = st[0];
		string t = st[1];
		Console.WriteLine(s.Equals(t));
	}
}
```
- - -
##### Go
###### STEP: 1 比較演算子：==
```go
package main
import "fmt"

func main() {
	var a, b int
	fmt.Scan(&a, &b)
	fmt.Println(a == b)
}
```
###### STEP: 2 比較演算子：!=
```go
package main
import "fmt"

func main() {
	var a, b int
	fmt.Scan(&a, &b)
	fmt.Println(a != b)
}
```
###### STEP: 3 比較演算子：<
```go
package main
import "fmt"

func main() {
	var a, b int
	fmt.Scan(&a, &b)
	fmt.Println(a < b)
}
```
###### STEP: 4 比較演算子：<=
```go
package main
import "fmt"

func main() {
	var a, b int
	fmt.Scan(&a, &b)
	fmt.Println(a <= b)
}
```
###### STEP: 5 式の比較
```go
package main
import "fmt"

func main() {
	var a, b, c, d int
	fmt.Scan(&a, &b, &c, &d)
	fmt.Println(a + b == c * d)
}
```
###### FINAL問題 文字列の比較
```go
package main
import "fmt"

func main() {
	var s, t string
	fmt.Scan(&s, &t)
	fmt.Println(s == t)
}
```
- - -
##### Java
###### STEP: 1 比較演算子：==
```java
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		System.out.println(sc.nextInt() == sc.nextInt());
		sc.close();
	}
}
```
###### STEP: 2 比較演算子：!=
```java
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		System.out.println(sc.nextInt() != sc.nextInt());
		sc.close();
	}
}
```
###### STEP: 3 比較演算子：<
```java
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		System.out.println(sc.nextInt() < sc.nextInt());
		sc.close();
	}
}
```
###### STEP: 4 比較演算子：<=
```java
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		System.out.println(sc.nextInt() <= sc.nextInt());
		sc.close();
	}
}
```
###### STEP: 5 式の比較
```java
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		System.out.println(sc.nextInt() + sc.nextInt() == sc.nextInt() * sc.nextInt());
		sc.close();
	}
}
```
###### FINAL問題 文字列の比較
```java
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		System.out.println(sc.next().equals(sc.next()));
		sc.close();
	}
}
```
- - -
##### JavaScript
###### STEP: 1 比較演算子：==
```js
const [a, b] = require("fs").readFileSync("/dev/stdin", "utf8").split(' ').map(Number);
console.log(a === b);
```
###### STEP: 2 比較演算子：!=
```js
const [a, b] = require("fs").readFileSync("/dev/stdin", "utf8").split(' ').map(Number);
console.log(a !== b);
```
###### STEP: 3 比較演算子：<
```js
const [a, b] = require("fs").readFileSync("/dev/stdin", "utf8").split(' ').map(Number);
console.log(a < b);
```
###### STEP: 4 比較演算子：<=
```js
const [a, b] = require("fs").readFileSync("/dev/stdin", "utf8").split(' ').map(Number);
console.log(a <= b);
```
###### STEP: 5 式の比較
```js
const [a, b, c, d] = require("fs").readFileSync("/dev/stdin", "utf8").split(' ').map(Number);
console.log(a + b === c * d);
```
###### FINAL問題 文字列の比較
```js
const [s, t] = require("fs").readFileSync("/dev/stdin", "utf8").trim().split(' ');
console.log(s === t);
```
- - -
##### Kotlin
###### STEP: 1 比較演算子：==
```kotlin
fun main() {
	val (a, b) = readLine()!!.split(' ').map { it.toInt() }
	println(a == b)
}
```
###### STEP: 2 比較演算子：!=
```kotlin
fun main() {
	val (a, b) = readLine()!!.split(' ').map { it.toInt() }
	println(a != b)
}
```
###### STEP: 3 比較演算子：<
```kotlin
fun main() {
	val (a, b) = readLine()!!.split(' ').map { it.toInt() }
	println(a < b)
}
```
###### STEP: 4 比較演算子：<=
```kotlin
fun main() {
	val (a, b) = readLine()!!.split(' ').map { it.toInt() }
	println(a <= b)
}
```
###### STEP: 5 式の比較
```kotlin
fun main() {
	val (a, b, c, d) = readLine()!!.split(' ').map { it.toInt() }
	println(a + b == c * d)
}
```
###### FINAL問題 文字列の比較
```kotlin
fun main() {
	val (s, t) = readLine()!!.split(' ')
	println(s.equals(t))
}
```
- - -
##### PHP
###### STEP: 1 比較演算子：==
```php
<?php
	[$a, $b] = array_map("intval", explode(' ', fgets(STDIN)));
	echo $a === $b ? 1 : 0, PHP_EOL;
?>
```
###### STEP: 2 比較演算子：!=
```php
<?php
	[$a, $b] = array_map("intval", explode(' ', fgets(STDIN)));
	echo $a !== $b ? 1 : 0, PHP_EOL;
?>
```
###### STEP: 3 比較演算子：<
```php
<?php
	[$a, $b] = array_map("intval", explode(' ', fgets(STDIN)));
	echo $a < $b ? 1 : 0, PHP_EOL;
?>
```
###### STEP: 4 比較演算子：<=
```php
<?php
	[$a, $b] = array_map("intval", explode(' ', fgets(STDIN)));
	echo $a <= $b ? 1 : 0, PHP_EOL;
?>
```
###### STEP: 5 式の比較
```php
<?php
	[$a, $b, $c, $d] = array_map("intval", explode(' ', fgets(STDIN)));
	echo $a + $b === $c * $d ? 1 : 0, PHP_EOL;
?>
```
###### FINAL問題 文字列の比較
```php
<?php
	[$s, $t] = explode(' ', trim(fgets(STDIN)));
	echo $s === $t ? 1 : 0, PHP_EOL;
?>
```
- - -
##### Perl
###### STEP: 1 比較演算子：==
```pl
my ($a, $b) = map { int($_) } split ' ', <STDIN>;
print $a == $b ? 1 : 0, $/;
```
###### STEP: 2 比較演算子：!=
```pl
my ($a, $b) = map { int($_) } split ' ', <STDIN>;
print $a != $b ? 1 : 0, $/;
```
###### STEP: 3 比較演算子：<
```pl
my ($a, $b) = map { int($_) } split ' ', <STDIN>;
print $a < $b ? 1 : 0, $/;
```
###### STEP: 4 比較演算子：<=
```pl
my ($a, $b) = map { int($_) } split ' ', <STDIN>;
print $a <= $b ? 1 : 0, $/;
```
###### STEP: 5 式の比較
```pl
my ($a, $b, $c, $d) = map { int($_) } split ' ', <STDIN>;
print $a + $b == $c * $d ? 1 : 0, $/;
```
###### FINAL問題 文字列の比較
```pl
my ($s, $t) = split ' ', <STDIN>;
print $s eq $t ? 1 : 0, $/;
```
- - -
##### Python3
###### STEP: 1 比較演算子：==
```py
a, b = map(int, input().split())
print(a == b)
```
###### STEP: 2 比較演算子：!=
```py
a, b = map(int, input().split())
print(a != b)
```
###### STEP: 3 比較演算子：<
```py
a, b = map(int, input().split())
print(a < b)
```
###### STEP: 4 比較演算子：<=
```py
a, b = map(int, input().split())
print(a <= b)
```
###### STEP: 5 式の比較
```py
a, b, c, d = map(int, input().split())
print(a + b == c * d)
```
###### FINAL問題 文字列の比較
```py
s, t = input().split()
print(s == t)
```
- - -
##### Ruby
###### STEP: 1 比較演算子：==
```rb
a, b = gets.split.map(&:to_i)
p a == b
```
###### STEP: 2 比較演算子：!=
```rb
a, b = gets.split.map(&:to_i)
p a != b
```
###### STEP: 3 比較演算子：<
```rb
a, b = gets.split.map(&:to_i)
p a < b
```
###### STEP: 4 比較演算子：<=
```rb
a, b = gets.split.map(&:to_i)
p a <= b
```
###### STEP: 5 式の比較
```rb
a, b, c, d = gets.split.map(&:to_i)
p a + b == c * d
```
###### FINAL問題 文字列の比較
```rb
s, t = gets.split
p s == t
```
- - -
##### Scala
###### STEP: 1 比較演算子：==
```scala
import scala.io.StdIn._

object Main extends App{
	val Array(a, b) = readLine().split(' ').map { _.toInt }
	println(a == b)
}
```
###### STEP: 2 比較演算子：!=
```scala
import scala.io.StdIn._

object Main extends App{
	val Array(a, b) = readLine().split(' ').map { _.toInt }
	println(a != b)
}
```
###### STEP: 3 比較演算子：<
```scala
import scala.io.StdIn._

object Main extends App{
	val Array(a, b) = readLine().split(' ').map { _.toInt }
	println(a < b)
}
```
###### STEP: 4 比較演算子：<=
```scala
import scala.io.StdIn._

object Main extends App{
	val Array(a, b) = readLine().split(' ').map { _.toInt }
	println(a <= b)
}
```
###### STEP: 5 式の比較
```scala
import scala.io.StdIn._

object Main extends App{
	val Array(a, b, c, d) = readLine().split(' ').map { _.toInt }
	println(a + b == c * d)
}
```
###### FINAL問題 文字列の比較
```scala
import scala.io.StdIn._

object Main extends App{
	val Array(s, t) = readLine().split(' ')
	println(s.equals(t))
}
```
- - -
##### Swift
###### STEP: 1 比較演算子：==
```swift
let ab = readLine()!.split(separator: " ").compactMap { Int($0) }
let (a, b) = (ab[0], ab[1])
print(a == b)
```
###### STEP: 2 比較演算子：!=
```swift
let ab = readLine()!.split(separator: " ").compactMap { Int($0) }
let (a, b) = (ab[0], ab[1])
print(a != b)
```
###### STEP: 3 比較演算子：<
```swift
let ab = readLine()!.split(separator: " ").compactMap { Int($0) }
let (a, b) = (ab[0], ab[1])
print(a < b)
```
###### STEP: 4 比較演算子：<=
```swift
let ab = readLine()!.split(separator: " ").compactMap { Int($0) }
let (a, b) = (ab[0], ab[1])
print(a <= b)
```
###### STEP: 5 式の比較
```swift
let abcd = readLine()!.split(separator: " ").compactMap { Int($0) }
let (a, b, c, d) = (abcd[0], abcd[1], abcd[2], abcd[3])
print(a + b == c * d)
```
###### FINAL問題 文字列の比較
```swift
let st = readLine()!.split(separator: " ")
let (s, t) = (st[0], st[1])
print(s == t)
```