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

paizaラーニングレベルアップ問題集の「2つの数値を出力」をやってみた。

Last updated at Posted at 2025-01-17

paizaラーニングレベルアップ問題集の2つの数値を出力をやってみました。


問題


方針

1 1という文字列を出力してもよいのですが、今回は改行なし出力と改行あり出力の関数・メソッドを使ってみました。


C
#include <stdio.h>

int main() {
	printf("%d", 1);
	putchar(' ');
	printf("%d", 1);
	puts("");
	return 0;
}

C++
#include <iostream>
using namespace std;

int main() {
	cout << 1 << ' ' << 1 << endl;
	return 0;
}

C#
using System;

class Program
{
	public static void Main()
	{
		Console.Write(1);
		Console.Write(' ');
		Console.Write(1);
		Console.WriteLine();
	}
}

Go
package main
import "fmt"

func main() {
	fmt.Print(1)
	fmt.Print(" ")
	fmt.Print(1)
	fmt.Println()
}

Java
public class Main {
	public static void main(String[] args) {
		System.out.print(1);
		System.out.print(' ');
		System.out.print(1);
		System.out.println();
	}
}

JavaScript
console.log(1, 1);

Kotlin
fun main() {
	print(1)
	print(' ')
	print(1)
	println()
}

PHP
<?php
	echo 1, ' ', 1, PHP_EOL;
?>

Perl
print 1, ' ', 1, $/;

Python3
print(1, 1)

Ruby
print 1, ' ', 1
puts

Scala
object Main extends App{
	print(1)
	print(' ')
	print(1)
	println()
}

Swift
print(1, 1)
0
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
0
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?