operator Aritmatika |
using System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
namespace Aritmatika
{
class Program
{
static void Main(string[]
args)
{
int
jumlah = 30;
int
harga = 20000;
int
total = jumlah * harga;
int
sisa,f = 45;
sisa = jumlah% f;
Console.WriteLine("total =\t" +total);
Console.WriteLine("sisa
=\t" +sisa);
Console.ReadLine();
}
}
}
Operator relasional
using System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
namespace
operator_relasional
{
class Program
{
static void Main(string[]
args)
{
bool
kondisi;
{
bool
nilai1,nilai2;
kondisi = 7==2;
nilai1= 10 >= 1;
nilai2= 4!=2;
Console.WriteLine("kondisi=\t"+kondisi);
Console.WriteLine("nilai1 =\t"+nilai1);
Console.WriteLine("nilai2 =\t"+nilai2);
Console.ReadLine();
}
}
}
}
Operator
shift
using System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
namespace
operator_shift
{
class Program
{
static void Main(string[]
args)
{
int
nilai1, nilai2;
nilai1 = 4>>1;
nilai2 = 2<<2;
Console.WriteLine("nilai1=\t" + nilai1);
Console.WriteLine("nilai2=\t" + nilai2);
Console.ReadLine();
}
}
}
Bitwise
complement
using System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
namespace
ConsoleApplication3
{
class Program
{
static void Main(string[]
args)
{
int
nilai1, nilai2;
nilai1 = 4&1;
nilai2 = 2|2;
Console.WriteLine("nilai1=\t" + nilai1);
Console.WriteLine("nilai2=\t" + nilai2);
Console.ReadLine();
}
}
}
Operator Aritmatika2
using System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
namespace
ConsoleApplication4
{
class Program
{
static void Main(string[]
args)
{
int
jumlah = 60;
int
harga = 40000;
int
total = jumlah * harga;
int
sisa,f = 90;
sisa = jumlah% f;
Console.WriteLine("total =\t" +total);
Console.WriteLine("sisa
=\t" +sisa);
Console.ReadLine();
}
}
}
using System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
namespace
ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
int
nilai1, nilai2;
nilai1 = 8 >> 2;
nilai2 = 4 << 4;
Console.WriteLine("nilai1=\t" + nilai1);
Console.WriteLine("nilai2=\t" + nilai2);
Console.ReadLine();
}
}
}
using System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
namespace
ConsoleApplication4
{
class Program
{
static void Main(string[]
args)
{
int
nilai1, nilai2;
nilai1 = 8 & 2;
nilai2 = 4 | 4;
Console.WriteLine("nilai1=\t" + nilai1);
Console.WriteLine("nilai2=\t" + nilai2);
Console.ReadLine();
}
}
}
No comments:
Post a Comment