Module Module1
Sub Main()
Dim a As Integer
Dim b As Integer
For a = 1 To 5
For b = 1 To a
Console.Write(b ^ 2)
Console.Write(" ")
Next b
Console.WriteLine()
Next a
Console.ReadLine()
End Sub
End Module
Hasi Output :
1
1 4
1 4 9
1 4 9 16
1 4 9 16 25
Tampilkan postingan dengan label Console. Tampilkan semua postingan
Tampilkan postingan dengan label Console. Tampilkan semua postingan
Minggu, 06 Mei 2012
Program Menghitung Nilai DNS pada Console Aplication
Module Module1
Sub Main()
Dim UTS, UAS As Integer
Dim Nilai As Long
Console.Write("Masukan Nilai UTS Anda: ")
UTS = Console.ReadLine
Console.Write("Masukan Nilai UAS Anda: ")
UAS = Console.ReadLine
Console.WriteLine("===========================")
Console.WriteLine("")
Nilai = (0.7 * UTS) + (0.3 * UAS)
Select Case Nilai
Case Is >= 80
Console.WriteLine(" Selamat Anda LULUS!")
Console.WriteLine(" Nilai Anda Pada DNS adalah: A")
Case Is >= 70
Console.WriteLine(" Selamat Anda LULUS!")
Console.WriteLine(" Nilai Anda Pada DNS adalah: B")
Case Is >= 60
Console.WriteLine(" Selamat Anda LULUS!")
Console.WriteLine(" Nilai Anda Pada DNS adalah: C")
Case Is >= 50
Console.WriteLine(" Selamat Anda LULUS!")
Console.WriteLine(" Nilai Anda Pada DNS adalah: D")
Case Else
Console.WriteLine(" Maaf Anda TIDAK LULUS!")
End Select
Console.Write(" Anda Mendapat Nilai: ")
Console.WriteLine(Nilai)
Console.WriteLine("===============================")
Console.ReadLine()
End Sub
End Module
Contoh:
Masukan Nilai UTS Anda: 80
Masukan Nilai UAS Anda: 70
===========================
Selamat Anda LULUS!
Nilai Anda Pada DNS adalah: B
Anda Mendapat Nilai: 77
===============================
Sub Main()
Dim UTS, UAS As Integer
Dim Nilai As Long
Console.Write("Masukan Nilai UTS Anda: ")
UTS = Console.ReadLine
Console.Write("Masukan Nilai UAS Anda: ")
UAS = Console.ReadLine
Console.WriteLine("===========================")
Console.WriteLine("")
Nilai = (0.7 * UTS) + (0.3 * UAS)
Select Case Nilai
Case Is >= 80
Console.WriteLine(" Selamat Anda LULUS!")
Console.WriteLine(" Nilai Anda Pada DNS adalah: A")
Case Is >= 70
Console.WriteLine(" Selamat Anda LULUS!")
Console.WriteLine(" Nilai Anda Pada DNS adalah: B")
Case Is >= 60
Console.WriteLine(" Selamat Anda LULUS!")
Console.WriteLine(" Nilai Anda Pada DNS adalah: C")
Case Is >= 50
Console.WriteLine(" Selamat Anda LULUS!")
Console.WriteLine(" Nilai Anda Pada DNS adalah: D")
Case Else
Console.WriteLine(" Maaf Anda TIDAK LULUS!")
End Select
Console.Write(" Anda Mendapat Nilai: ")
Console.WriteLine(Nilai)
Console.WriteLine("===============================")
Console.ReadLine()
End Sub
End Module
Contoh:
Masukan Nilai UTS Anda: 80
Masukan Nilai UAS Anda: 70
===========================
Selamat Anda LULUS!
Nilai Anda Pada DNS adalah: B
Anda Mendapat Nilai: 77
===============================
Kamis, 12 April 2012
Contoh Program Console Menghitung Jumlah Harga
Module Module1
Sub Main()
Dim hasil As Integer
Dim jb As Integer
Console.Write("Masukan Jumlah Barang : ")
jb = Console.ReadLine()
Console.WriteLine("")
If jb > 100 Then
hasil = 0.8 * 20000 * jb
Console.WriteLine("Diskon 20%")
ElseIf jb > 10 Then
hasil = 0.9 * 20000 * jb
Console.WriteLine("Diskon 10 %")
Else
hasil = 20000 * jb
Console.WriteLine("Anda Tidak Mendapat Diskon")
End If
Console.WriteLine("======================================")
Console.WriteLine("Harga satuan = Rp 20000")
Console.WriteLine("Jumlah Yang harus Dibayar: Rp {0}", hasil)
Console.WriteLine("======================================")
Console.WriteLine("")
Console.WriteLine("")
Console.WriteLine(" Terima Kasih")
Console.WriteLine(" ============")
Console.ReadLine()
End Sub
End Module
Sub Main()
Dim hasil As Integer
Dim jb As Integer
Console.Write("Masukan Jumlah Barang : ")
jb = Console.ReadLine()
Console.WriteLine("")
If jb > 100 Then
hasil = 0.8 * 20000 * jb
Console.WriteLine("Diskon 20%")
ElseIf jb > 10 Then
hasil = 0.9 * 20000 * jb
Console.WriteLine("Diskon 10 %")
Else
hasil = 20000 * jb
Console.WriteLine("Anda Tidak Mendapat Diskon")
End If
Console.WriteLine("======================================")
Console.WriteLine("Harga satuan = Rp 20000")
Console.WriteLine("Jumlah Yang harus Dibayar: Rp {0}", hasil)
Console.WriteLine("======================================")
Console.WriteLine("")
Console.WriteLine("")
Console.WriteLine(" Terima Kasih")
Console.WriteLine(" ============")
Console.ReadLine()
End Sub
End Module
Sabtu, 07 April 2012
Contoh Program Mneghitung DNS Pada VB.Net Console
Contoh Program Mneghitung DNS Pada VB.Net Console
Module Module1
Sub Main()
Dim UTS, UAS As Integer
Dim DNS As Long
Console.Write("Masukan Nilai UTS Anda: ")
UTS = Console.ReadLine
Console.Write("Masukan Nilai UAS Anda: ")
UAS = Console.ReadLine
Console.WriteLine("===========================")
Console.WriteLine("")
DNS = (0.7 * UTS) + (0.3 * UAS)
Select Case DNS
Case Is >= 80
Console.WriteLine(" Selamat Anda LULUS!")
Console.WriteLine(" Anda Mendapat Nilai A")
Case Is >= 70
Console.WriteLine(" Selamat Anda LULUS!")
Console.WriteLine(" Anda Mendapat Nilai B")
Case Is >= 60
Console.WriteLine(" Selamat Anda LULUS!")
Console.WriteLine(" Anda Mendapat Nilai C")
Case Is >= 50
Console.WriteLine(" Selamat Anda LULUS!")
Console.WriteLine(" Anda Mendapat Nilai D")
Case Else
Console.WriteLine(" Maaf Anda TIDAK LULUS!")
End Select
Console.Write("Nilai Anda Pada DNS adalah: ")
Console.WriteLine(DNS)
Console.WriteLine("===============================")
Console.ReadLine()
End Sub
End Module
COntoh :
Masukan Nilai UTS Anda: 78
Masukan Nilai UAS Anda: 46
===========================
Selamat Anda LULUS!
Anda Mendapat Nilai C
Nilai Anda Pada DNS adalah: 68
===============================
Module Module1
Sub Main()
Dim UTS, UAS As Integer
Dim DNS As Long
Console.Write("Masukan Nilai UTS Anda: ")
UTS = Console.ReadLine
Console.Write("Masukan Nilai UAS Anda: ")
UAS = Console.ReadLine
Console.WriteLine("===========================")
Console.WriteLine("")
DNS = (0.7 * UTS) + (0.3 * UAS)
Select Case DNS
Case Is >= 80
Console.WriteLine(" Selamat Anda LULUS!")
Console.WriteLine(" Anda Mendapat Nilai A")
Case Is >= 70
Console.WriteLine(" Selamat Anda LULUS!")
Console.WriteLine(" Anda Mendapat Nilai B")
Case Is >= 60
Console.WriteLine(" Selamat Anda LULUS!")
Console.WriteLine(" Anda Mendapat Nilai C")
Case Is >= 50
Console.WriteLine(" Selamat Anda LULUS!")
Console.WriteLine(" Anda Mendapat Nilai D")
Case Else
Console.WriteLine(" Maaf Anda TIDAK LULUS!")
End Select
Console.Write("Nilai Anda Pada DNS adalah: ")
Console.WriteLine(DNS)
Console.WriteLine("===============================")
Console.ReadLine()
End Sub
End Module
COntoh :
Masukan Nilai UTS Anda: 78
Masukan Nilai UAS Anda: 46
===========================
Selamat Anda LULUS!
Anda Mendapat Nilai C
Nilai Anda Pada DNS adalah: 68
===============================
Contoh Program Menghitung Jumlah Harga Pada VB.Net Console
Contoh Program Menghitung Jumlah Harga Pada VB.Net Console
Module Module1
Sub Main()
Dim hasil As Integer
Dim jb As Integer
Console.Write("Masukan Jumlah Barang : ")
jb = Console.ReadLine()
Console.WriteLine("")
If jb > 100 Then
hasil = 0.8 * 20000 * jb
Console.WriteLine("Diskon 20%")
ElseIf jb > 10 Then
hasil = 0.9 * 20000 * jb
Console.WriteLine("Diskon 10 %")
Else
hasil = 20000 * jb
Console.WriteLine("Anda Tidak Mendapat Diskon")
End If
Console.WriteLine("======================================")
Console.WriteLine("Harga satuan = Rp 20000")
Console.WriteLine("Jumlah Yang harus Dibayar: Rp {0}", hasil)
Console.WriteLine("======================================")
Console.WriteLine("")
Console.WriteLine("")
Console.WriteLine(" Terima Kasih")
Console.WriteLine(" ============")
Console.ReadLine()
End Sub
End Module
Module Module1
Sub Main()
Dim hasil As Integer
Dim jb As Integer
Console.Write("Masukan Jumlah Barang : ")
jb = Console.ReadLine()
Console.WriteLine("")
If jb > 100 Then
hasil = 0.8 * 20000 * jb
Console.WriteLine("Diskon 20%")
ElseIf jb > 10 Then
hasil = 0.9 * 20000 * jb
Console.WriteLine("Diskon 10 %")
Else
hasil = 20000 * jb
Console.WriteLine("Anda Tidak Mendapat Diskon")
End If
Console.WriteLine("======================================")
Console.WriteLine("Harga satuan = Rp 20000")
Console.WriteLine("Jumlah Yang harus Dibayar: Rp {0}", hasil)
Console.WriteLine("======================================")
Console.WriteLine("")
Console.WriteLine("")
Console.WriteLine(" Terima Kasih")
Console.WriteLine(" ============")
Console.ReadLine()
End Sub
End Module
Langganan:
Postingan (Atom)