 
  Number /
 0
 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 Number /
 0
 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
※整数以外の入力、ゼロ除算などのエラーチェックは考慮していません。
$ ./test #1 >12 #2 >5 12 + 5 = 17 12 - 5 = 7 12 * 5 = 60 12 / 5 = 2 $
#include <stdio.h>
int main()
{
  int a = 0, b = 0;
  
  printf("#1 > ");
  scanf("%d",&a);
  
  printf("#2 > ");
  scanf("%d",&b);
  
  printf("%d + %d = %d\n", a, b,  a + b);
  printf("%d - %d = %d\n", a, b,  a - b);
  printf("%d * %d = %d\n", a, b,  a * b);
  printf("%d / %d = %d\n", a, b,  a / b);
  
  return 0;
}
#include <iostream>
int main()
{
  int a = 0, b = 0;
  
  std::cout << "#1 > ";
  std::cin >> a;
  
  std::cout << "#2 > ";
  std::cin >> b;
  
  std::cout << a << " + " << b << " = " << a + b << std::endl;
  std::cout << a << " - " << b << " = " << a - b << std::endl;
  std::cout << a << " * " << b << " = " << a * b << std::endl;
  std::cout << a << " / " << b << " = " << a / b << std::endl;
  
  return 0;
}
import java.io.*;
class Main {
    
    public static void main(String[] args) {
        
        try {
            
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            
            System.out.print("#1 >");
            int a = Integer.parseInt(reader.readLine());
            System.out.print("#2 >");
            int b = Integer.parseInt(reader.readLine());
            
            System.out.println( a + " + " + b + " = " + (a + b) );
            System.out.println( a + " - " + b + " = " + (a - b) );
            System.out.println( a + " * " + b + " = " + (a * b) );
            System.out.println( a + " / " + b + " = " + (a / b) );
            
        } catch (Exception e) {
            // IOException
            // NumberFormatException
            // ArithmeticException
            e.printStackTrace();
        }
        
    }
    
}
print"#1 >"; chomp(my $a = <STDIN>); print"#2 >"; chomp(my $b = <STDIN>); printf"%d + %d = %d\n", $a, $b, $a + $b; printf"%d - %d = %d\n", $a, $b, $a - $b; printf"%d * %d = %d\n", $a, $b, $a * $b; printf"%d / %d = %d\n", $a, $b, int($a / $b);
print "#1 >"
a = gets.to_i
print "#2 >"
b = gets.to_i
puts "#{a} + #{b} = #{a + b}"
puts "#{a} - #{b} = #{a - b}"
puts "#{a} * #{b} = #{a * b}"
puts "#{a} / #{b} = #{a / b}"
最終更新日 : 2005.05.28
 
  Number /
 0
 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 Number /
 0
 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
copyright 2000-2005
ARGIUS project