Koding C# Menentukan Gaji Pegawai Dengn Menggunakn Login

menentukan gaji pegawai dengn menggunakn login





using System;
usingSystem.Collections.Generic;
usingSystem.Linq;
usingSystem.Text;

namespace ConsoleApplication7
{
classProgram
    {
staticvoid Main(string[] args)
        {
string username, pass;
intpilih;

Console.WriteLine("*********************");
Console.WriteLine(" Please Login");
Console.WriteLine("---------------------");
Console.WriteLine("");
Console.WriteLine("%%%%%%%%%%%%%%%%%%%%%");



Console.Write("username  : ");
username = Console.ReadLine();
Console.Write("pass      : ");
pass = Console.ReadLine();
Console.WriteLine("____________________________");
Console.WriteLine("*******************");

if (username == "HIDAYAT MAULANA"&& pass == "141100088")
            {
Console.WriteLine("NAMA : HIDAYAT MAULANA");
Console.WriteLine("BP   : 141100088");
Console.WriteLine();
Console.WriteLine("PilihGolongan:");
Console.WriteLine("1. Golongan A");
Console.WriteLine("2. Golongan B");
Console.WriteLine("3. Golongan C");
Console.WriteLine("4. Golongan D");
Console.Write("MasukkanPilihan :");
pilih = int.Parse(Console.ReadLine());

switch (pilih)
                {
case 1: { golongan_A(); }
break;
case 2: { golongan_B(); }
break;
case 3: { golongan_C(); }
break;
case 4: { golongan_D(); }
break;
default: { Console.WriteLine("Golongan Salah!"); }
break;
                }
            }
else
            {
Console.WriteLine(" username dan pass andasalah ");

            }
Console.ReadLine();
        }

staticvoidgolongan_A()
        {

stringnama;
double jam, gaji, pajak, lembur, total;

Console.Write("NamaPegawai : ");
nama = Console.ReadLine();
Console.Write("Jam          : ");
jam = double.Parse(Console.ReadLine());

gaji = 0;
pajak = 0;
lembur = 0;
total = 0;

if (jam <= 48)
            {
gaji = (jam * 50000) * 4;
            }
else
            {
gaji = 48 * 50000;
lembur = (jam - 48) * 30000;
            }

pajak = (gaji + lembur) * (0.5 / 100);
total = gaji + lembur - pajak;

Console.WriteLine("GajiPokok : " + gaji);
Console.WriteLine("Lembur     : " + lembur);
Console.WriteLine("Pajak      : " + pajak);
Console.WriteLine("Total gaji : " + total);
        }

staticvoidgolongan_B()
        {

stringnama;
double jam, gaji, pajak, lembur, total;

Console.Write("NamaPegawai : ");
nama = Console.ReadLine();
Console.Write("jam          : ");
jam = double.Parse(Console.ReadLine());

gaji = 0;
pajak = 0;
lembur = 0;
total = 0;

if (jam <= 48)
            {
gaji = (jam * 60000) * 4;
            }
else
            {
gaji = 48 * 60000;
lembur = (jam - 48) * 30000;
            }

pajak = (gaji + lembur) * (0.5 / 100);
total = gaji + lembur - pajak;
Console.WriteLine("*******************");
Console.WriteLine("GajiPokok : " + gaji);
Console.WriteLine("Lembur     : " + lembur);
Console.WriteLine("Pajak      : " + pajak);
Console.WriteLine("Total gaji : " + total);
Console.WriteLine("*******************");
        }

staticvoidgolongan_C()
        {

stringnama;
double jam, gaji, pajak, lembur, total;
Console.WriteLine("*******************");
Console.Write("NamaPegawai : ");
nama = Console.ReadLine();
Console.Write("jam          : ");
Console.WriteLine("*******************");
jam = double.Parse(Console.ReadLine());

gaji = 0;
pajak = 0;
lembur = 0;
total = 0;

if (jam <= 48)
            {
gaji = (jam * 70000) * 4;
            }
else
            {
gaji = 48 * 70000;
lembur = (jam - 48) * 30000;
            }

pajak = (gaji + lembur) * (0.5 / 100);
total = gaji + lembur - pajak;
Console.WriteLine("*******************");
Console.WriteLine("GajiPokok : " + gaji);
Console.WriteLine("Lembur     : " + lembur);
Console.WriteLine("Pajak      : " + pajak);
Console.WriteLine("Total gaji : " + total);
Console.WriteLine("*******************");
        }

staticvoidgolongan_D()
        {

stringnama;
double jam, gaji, pajak, lembur, total;
Console.WriteLine("*******************");
Console.Write("NamaPegawai : ");
nama = Console.ReadLine();
Console.Write("jam          : ");
Console.WriteLine("*******************");
jam = double.Parse(Console.ReadLine());

gaji = 0;
pajak = 0;
lembur = 0;
total = 0;

if (jam <= 48)
            {
gaji = (jam * 80000) * 4;
            }
else
            {
gaji = 48 * 80000;
lembur = (jam - 48) * 30000;
            }

pajak = (gaji + lembur) * (0.5 / 100);
total = gaji + lembur - pajak;
Console.WriteLine("*******************");
Console.WriteLine("GajiPokok : " + gaji);
Console.WriteLine("Lembur     : " + lembur);
Console.WriteLine("Potongan      : " + pajak);
Console.WriteLine("Total gaji : " + total);
Console.WriteLine("*******************");
        }
    }

}

koding C# Membuat demensi segitiga

Membuat demensi segitiga





using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n, i, j;
           
            for (i = 1; i <= n; i++)
            {
                for (j = 1; j <= i; j++)
                { Console.Write("" + j); }
                Console.WriteLine();

            }
            for (i = n; i >= 1; i--)
            {
                for (j = 1; j <= i; j++)
                { Console.Write("" + j); }
                Console.WriteLine();
            }
            Console.ReadLine();
        }
    }

}

Koding C# Menghitung Nilai Faktorial


Menghitung nilai faktorial 






using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication31
{
    class Program
    {
        static void Main(string[] args)
        {
            int n, k, fak;
        
            Console.WriteLine("SELAMAT DATANG DIPROGRAM INI ");
            Console.WriteLine("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
            Console.Write(" SilakanMasukkan Nilai N :");
            double hasil = 0.00;
            string soal = "";
            n = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("Menghitung Hasil Faktorial :  ");
            for (int i = 1; i <= n; i++)
            {
                if (i == 1)
                {
                    soal = "1/" + i + "!";
                }
                else
                {
                    soal = soal + " + " + "1/" + i + "!";
                }
                fak = 1;
                for (k = 1; k <= i; k++)
                {
                    fak = fak * k;
                }
                hasil = hasil + (1 / Convert.ToDouble(fak));
                //Console.WriteLine(hasil);

            }
            Console.WriteLine(soal + " = " + hasil);
            Console.ReadLine();
        }
    }

}

Koding C# Menghitung Jumlah


menghitung Jumlah





using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication32
{
    class Program
    {
        static void Main(string[] args)
        {
           
           
            int hasil = 0;
            Double x2 = 0.00, varians = 0;
            String soal = "", opr = "";

            int angka = Convert.ToInt16(Console.ReadLine());
           
            Console.WriteLine("Menghitung Jumlah  : ");

            for (int i = 1; i <= angka; i++)
            {
                if (i % 2 == 0)
                {
                    opr = "+";
                    hasil = hasil + i;
                }
                else
                {
                    if (i == 1)
                    {
                        hasil = hasil + i;
                    }
                    else
                    {
                        opr = "-";
                        hasil = hasil - i;

                    }

                }

                x2 = x2 + Math.Pow(i, 2);
                //membangun soal
                soal = soal + " " + opr + " " + Convert.ToString(i);
            }
            //ini rumus Varians
            varians = (x2 - (Math.Pow(hasil, 2)) / angka) / angka - 1;
            //tampilkan Soal hasil
            Console.WriteLine(soal + " = " + hasil + "\n");
            //tampilkan Varians
            Console.WriteLine("Varians =  " + varians);
            Console.ReadKey();
        }
    }
}


koding C# Bilanagn Pima dan Ganjil





using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HIdayat_MAulana_141100088
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Nama     : hidayat maulana");
            Console.WriteLine("BP       : 141100088");
            Console.WriteLine("");
            Console.WriteLine("MUsukan blangan prima dan genap anda    :");
            int i, n, fakt;
            fakt = 0;
            for (i = 2; i <= 50; i++)
            {

                for (n = 2; n <= Math.Sqrt(i); n++)
                { if (n % i == 0)fakt++; }
                if (fakt == 0)
                {
                    Console.WriteLine("Bilangan     :" + i);
                    Console.WriteLine("");
                    Console.WriteLine("BILANGAN GANJIL PRIMA    :");
                }
                for (i = 3; i <= 50; i++)
                {
                    fakt = 0;
                    for (n = 2; n <= Math.Sqrt(i); n++)
                    { if (i % n == 0)fakt++; }
                    if (fakt == 0)
                    { Console.WriteLine("Bilangan     :" + i); }

                } Console.ReadLine();
            }
        }
    }

}

koding C# Geser Kiri Dan Geser Kanan



GESER KIRI DAN GESER KANAN






using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Try
{
    class hidayat_maulana_array
    {                                            

        static void Main(string[] args)
        {
            Console.WriteLine("     WELCOME IN THE BIG PROGRAM");
            Console.WriteLine("           STMIK INDONESIA");
            Console.WriteLine("");
            Console.Write("Jumlah Indeks : ");
            int n = int.Parse(Console.ReadLine());
            input_array(n);
            Console.WriteLine();
            input_array2(n);
            Console.ReadLine();
        }
        static void input_array(int n)
        {
            string[] x = new string[n];
            for (int i = 0; i <= x.Length - 1; i++)
            {
                Console.Write("Array geser Kiri > masukkan nilai array ke " + i + ": ");

                string a = Console.ReadLine();
                x[i] = a;
            }

            Console.WriteLine("Proses array : ");
            tampilan_array(x, n);
            kiri_array(x, n);
            Console.WriteLine("array geser kiri : ");
            tampilan_array(x, n);

        }
        static void input_array2(int n)
        {
            string[] x = new string[n];
            for (int i = 0; i <= x.Length - 1; i++)
            {
                Console.Write("Array geser Kanan > masukkan nilai array ke " + i + ": ");

                string a = Console.ReadLine();
                x[i] = a;
            }

            Console.WriteLine("Proses Array : ");
            tampilan_array2(x, n);
            kanan_array(x, n);
            Console.WriteLine("array geser kanan : ");
            tampilan_array2(x, n);

        }

        static void tampilan_array(string[] x, int n)
        {
            Console.WriteLine("Array : ");
            for (int j = 0; j <= n - 1; j++)
            {
                Console.WriteLine(x[j]);
            }
        }


        static void kiri_array(string[] x, int n)
        {

            for (int j = 0; j <= n - 1; j++)
            {

                if (j == 0)
                {
                    x[j] = "B";
                }
                {
                    if (j == 1)
                    {
                        x[j] = "C";
                    }
                }
                {
                    if (j == 2)
                    {
                        x[j] = "D";
                    }
                }
                {
                    if (j == 3)
                    {
                        x[j] = "E";
                    }
                }
                {
                    if (j == 4)
                    {
                        x[j] = "F";
                    }
                }
                {
                    if (j == 5)
                    {
                        x[j] = "G";
                    }
                }
                {
                    if (j == 6)
                    {
                        x[j] = "A";
                    }
                }

            }

            tampilan_array(x, n);
        }

        static void tampilan_array2(string[] x, int n)
        {

            Console.WriteLine("Array : ");
            for (int j = 0; j <= n - 1; j++)
            {
                Console.WriteLine(x[j]);
            }
        }
        static void kanan_array(string[] x, int n)
        {

            for (int j = 0; j <= n - 1; j++)
            {



                if (j == 0)
                {
                    x[j] = "G";
                }
                {
                    if (j == 1)
                    {
                        x[j] = "A";
                    }
                }
                {
                    if (j == 2)
                    {
                        x[j] = "B";
                    }
                }
                {
                    if (j == 3)
                    {
                        x[j] = "C";
                    }
                }
                {
                    if (j == 4)
                    {
                        x[j] = "D";
                    }
                }
                {
                    if (j == 5)
                    {
                        x[j] = "E";
                    }
                }
                {
                    if (j == 6)
                    {
                        x[j] = "F";
                    }
                }



            }

            tampilan_array(x, n);
        }
    }

}
luvne.com resepkuekeringku.com desainrumahnya.com yayasanbabysitterku.com