Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace cekNim
- {
- class Program
- {
- static void Main(string[] args)
- {
- string nama, nim;
- try
- {
- Console.Write("NIM = ");
- nim = Console.ReadLine();
- if (nim.Trim().Length <= 0)
- throw new Exception("NIM tidak boleh kosong");
- else if (nim.Trim().Length < 9 || nim.Trim().Length <9)
- throw new Exception("NIM Maksimum 9 digit");
- Console.Write("Nama = ");
- nama = Console.ReadLine();
- if (nama.Trim().Length <= 0)
- throw new Exception("Nama Mahasiswa tidak boleh kosong");
- else if (nama.Trim().Length > 100)
- throw new Exception("Nama Mahasiswa maksimum 100 karakter");
- Console.WriteLine("/nMahasiswa dengan NIM = {0} Bernama {1)", nim, nama);
- }
- catch(Exception e)
- {
- Console.WriteLine("ERROR : {0}", e.Message);
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement