문서 편집 권한이 없습니다. 다음 이유를 확인해주세요: 요청한 명령은 다음 권한을 가진 사용자에게 제한됩니다: 사용자. 문서의 원본을 보거나 복사할 수 있습니다. ==개요== * {{BOJ|1008}} * {{BOJ단계|1}} * 두 수의 나눗셈 * 알고리즘 분류: 사칙연산 ==C== <syntaxhighlight lang='c'> #include <stdio.h> int main() { int a, b; scanf("%d %d",&a,&b); printf("%.9f\n",1.0*a/b); return 0; } </syntaxhighlight> <syntaxhighlight lang='c'> #include <stdio.h> int main() { double a, b; scanf("%lf %lf",&a,&b); printf("%.9f\n",a/b); return 0; } </syntaxhighlight> ==C++== <syntaxhighlight lang='c'> #include <iostream> using namespace std; int main() { double a, b; cin >> a >> b; printf("%.9f\n", a/b); return 0; } </syntaxhighlight> ==C#== <syntaxhighlight lang='c'> using System; public class Program { public static void Main() { string s = Console.ReadLine(); string[] ss = s.Split(); double a = double.Parse(ss[0]); double b = double.Parse(ss[1]); Console.WriteLine(a/b); } } </syntaxhighlight> ==CMD== <syntaxhighlight lang='dos'> @echo off set /p line= for /f "tokens=1" %%G IN ("%line%") DO set a=%%G for /f "tokens=2" %%G IN ("%line%") DO set b=%%G set /a "c=%a%/%b%" echo %c% </syntaxhighlight> ==Go== <syntaxhighlight lang='go'> package main import "fmt" func main() { var a, b int fmt.Scanf("%d %d", &a, &b) fmt.Printf("%d\n", a/b) } </syntaxhighlight> ==Java== <syntaxhighlight lang='Java'> import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); double a = sc.nextDouble(); double b = sc.nextDouble(); System.out.println(a / b); } } </syntaxhighlight> ==node.js== <syntaxhighlight lang='javascript'> var fs = require('fs'); var input = fs.readFileSync('/dev/stdin').toString().split(' '); var a = parseInt(input[0]); var b = parseInt(input[1]); console.log(a/b); </syntaxhighlight> ==Perl== <syntaxhighlight lang='perl'> my ($a, $b) = split(/ /, <>); print $a / $b; </syntaxhighlight> <syntaxhighlight lang='perl'> $_=<>; s# #/#; print eval; </syntaxhighlight> ==PHP== <syntaxhighlight lang='php'> <?php fscanf(STDIN,"%d %d",$a,$b); fprintf(STDOUT,"%s",$a/$b); </syntaxhighlight> <syntaxhighlight lang='PHP'> <?php fscanf(STDIN,"%d %d",$a,$b); echo $a/$b; </syntaxhighlight> ==Python== <syntaxhighlight lang='python'> a, b = map(int, input().split()) print(a/b) </syntaxhighlight> ==R== <syntaxhighlight lang='r'> x=scan("stdin") cat(sprintf('%.9f',x[1]/x[2])) </syntaxhighlight> <syntaxhighlight lang='r'> x = scan("stdin") a = x[1] b = x[2] cat(sprintf('%.9f', a/b)) </syntaxhighlight> ==Ruby== <syntaxhighlight lang='ruby'> a, b = gets.split puts a.to_f / b.to_f </syntaxhighlight> ==같이 보기== * [[BOJ 1000 A+B]] * [[BOJ 1001 A-B]] * [[BOJ 2558 A+B - 2]] * [[BOJ 10998 A×B]] 이 문서에서 사용한 틀: 틀:BOJ (원본 보기) 틀:BOJ/core (원본 보기) 틀:BOJ 단계 (원본 보기) 틀:BOJ단계 (원본 보기) 틀:Favicon (원본 보기) 모듈:Ustring (원본 보기) BOJ 1008 A/B 문서로 돌아갑니다.