Advertisement
kadoel

MonoDevelop C# Mencari zodiak dengan SubString

Apr 16th, 2012
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 5.31 KB | None | 0 0
  1. /*
  2.  
  3.     Name            : mencari zodiak dengan substring
  4.     Source by   : kadeol noesa
  5.    
  6.  */
  7.  
  8. using System;
  9.  
  10. namespace kadoel
  11. {
  12.     class MainClass
  13.     {
  14.         public static void Main (string[] args)
  15.         {
  16.             String lahir;
  17.             String tanggal;
  18.             String bulan;
  19.             String pil;
  20.             int day;
  21.             int month;
  22.         ulang :
  23.             Console.Write("Masukkan tanggal Lahir : ");
  24.             lahir = Console.ReadLine();
  25.             tanggal = lahir.Substring(0, 2);
  26.             day = Convert.ToInt32(tanggal);
  27.             bulan = lahir.Substring(3, 2);
  28.             month = Convert.ToInt32(bulan);
  29.  
  30.             if (month == 01)
  31.             {
  32.                 if ((day >= 01) && (day <= 19))
  33.                 {
  34.                     Console.Write("Anda Berzodiak CAPRICORN");
  35.  
  36.                 }
  37.                 else if ((day >= 20) && (day <= 31))
  38.                 {
  39.                     Console.Write("Anda Berzodiak AQUARIUS");
  40.                 }
  41.             }
  42.  
  43.             if (month == 02)
  44.             {
  45.                 if ((day >= 01) && (day <= 18))
  46.                 {
  47.                     Console.Write("Anda Berzodiak AQUARIUS");
  48.                 }
  49.                 else if ((day >= 19) && (day <= 29))
  50.                 {
  51.                     Console.Write("Anda Berzodiak PISCES");
  52.                 }
  53.             }
  54.             if (month == 03)
  55.             {
  56.                 if ((day >= 01) && (day <= 20))
  57.                 {
  58.                     Console.Write("Anda Berzodiak PISCES");
  59.                 }
  60.                 else if ((day >= 21) && (day <= 31))
  61.                 {
  62.                     Console.Write("Anda Berzodiak ARIES");
  63.                 }
  64.             }
  65.             if (month == 04)
  66.             {
  67.                 if ((day >= 01) && (day <= 20))
  68.                 {
  69.                     Console.WriteLine("Anda Berzodiak ARIES");
  70.                 }
  71.                 else if ((day >= 21) && (day <= 30))
  72.                 {
  73.                     Console.Write("Anda Berzodiak TAURUS");
  74.                 }
  75.             }
  76.             if (month == 05)
  77.             {
  78.                 if ((day >= 01) && (day <= 20))
  79.                 {
  80.                     Console.Write("Anda Berzodiak TAURUS");
  81.                 }
  82.                 else if ((day >= 21) && (day <= 31))
  83.                 {
  84.                     Console.Write("Anda Berzodiak GEMINI");
  85.                 }
  86.             }
  87.             if (month == 06)
  88.             {
  89.                 if ((day >= 01) && (day <= 20))
  90.                 {
  91.                     Console.Write("Anda Berzodiak GEMINI");
  92.                 }
  93.                 else if ((day >= 21) && (day <= 30))
  94.                 {
  95.                     Console.Write("Anda Berzodiak CANCER");
  96.                 }
  97.             }
  98.             if (month == 07)
  99.             {
  100.                 if ((day >= 01) && (day <= 21))
  101.                 {
  102.                     Console.Write("Anda Berzodiak CANCER");
  103.                 }
  104.                 else if ((day >= 22) && (day <= 31))
  105.                 {
  106.                     Console.Write("Anda Berzodiak LEO");
  107.                 }
  108.             }
  109.             if (month == 08)
  110.             {
  111.                 if ((day >= 01) && (day <= 20))
  112.                 {
  113.                     Console.Write("Anda Berzodiak LEO");
  114.                 }
  115.                 else if ((day >= 21) && (day <= 31))
  116.                 {
  117.                     Console.Write("Anda Berzodiak VIRGO");
  118.                 }
  119.             }
  120.             if (month == 09)
  121.             {
  122.                 if ((day >= 01) && (day <= 22))
  123.                 {
  124.                     Console.Write("Anda Berzodiak VIRGO");
  125.                 }
  126.                 else if ((day >= 23) && (day <= 30))
  127.                 {
  128.                     Console.Write("Anda Berzodiak LIBRA");
  129.                 }
  130.             }
  131.             if (month == 10)
  132.             {
  133.                 if ((day >= 01) && (day <= 22))
  134.                 {
  135.                     Console.Write("Anda Berzodiak LIBRA");
  136.                 }
  137.                 else if ((day >= 23) && (day <= 31))
  138.                 {
  139.                     Console.Write("Anda Berzodiak SCORPIO");
  140.                 }
  141.             }
  142.             if (month == 11)
  143.             {
  144.                 if ((day >= 01) && (day <= 22))
  145.                 {
  146.                     Console.Write("Anda Berzodiak SCORPIO");
  147.                 }
  148.                 else if ((day >= 23) && (day <= 30))
  149.                 {
  150.                     Console.Write("Anda Berzodiak SAGITARIUS");
  151.                 }
  152.             }
  153.             if (month == 12)
  154.             {
  155.                 if ((day >= 1) && (day <= 20))
  156.                 {
  157.                     Console.Write("Anda Berzodiak SAGITARIUS");
  158.                 }
  159.                 else if ((day >= 21) && (day <= 31))
  160.                 {
  161.                     Console.Write("Anda Berzodiak CAPRICORN");
  162.                 }
  163.             }
  164.            
  165.             Console.WriteLine();
  166.                 ulng:
  167.             Console.Write("Apakah anda Ingin Mencoba lagi [Y/N] ? ");
  168.             pil = Console.ReadLine();
  169.            
  170.             if (pil=="y" || pil=="Y")
  171.             {
  172.                 Console.Clear();
  173.                 goto ulang;
  174.             }
  175.            
  176.             if (pil =="n" || pil == "N")
  177.             {
  178.                 Console.Clear();
  179.                 Console.Write("TERIMAKASI");
  180.             }
  181.            
  182.             else
  183.             {
  184.                 Console.Clear();
  185.                 goto ulng;
  186.             }
  187.             Console.ReadLine();
  188.         }
  189.     }
  190. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement