본문 바로가기
C#

산술 연산자 Arithmatic0perators

by JAESEONG LEE- developer 2022. 7. 18.

산술 연산자는 다음과 같이 두 개의 피연산자를 필요로 합니다. 연산자가 가운데에 오고, 피연산자가 연산자 양 옆에 위치하는 꼴 입니다. 두개의 피연산자가 필요한 연산자를 이항 연산자라고 부릅니다.

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
using System;
 
namespace Arithmatic0perators
{
    class MainApp
    {
        static void Main(string[] args)
        {
            int a = 111 + 222;
            Console.WriteLine("a : {0}", a);
 
            int b = a - 100;
            Console.WriteLine("b : {0}", b);
 
            int c = b * 10;
            Console.WriteLine("c : {0}", c);
 
            double d = c / 6.3;
            Console.WriteLine("d : {0}", d);
 
            
 
            Console.WriteLine("22 / 7 = {0}({1})"22 / 722 % 7);
        }
    }
}
cs

 

 

실행 결과입니다.