Thursday, October 20, 2011

cek no hape dalam c#.

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

namespace ConsoleApplication8
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("masukan no handphone");
            string s = (Console.ReadLine());
            int n = s.Length;
                if (n == 12)
                {
                    string sub = s.Substring(0, 4);
                    if (sub == "0819")
                    {
                        Console.WriteLine("xl");
                    }
                    if (sub == "0821")
                    {
                        Console.WriteLine("telkomsel");
                    }
                    if (sub == "0857")
                    {
                        Console.WriteLine("indosat");
                    }
                    else
                    {
                        Console.WriteLine("maav no hape tidak terdaftar");
                }
            }
             
            else
            {
                Console.WriteLine("bukan no hape");
            }
        }
    }
}

No comments:

Post a Comment