Tahun Kabisat : Determining Leap Year in Program
Leap year is the year that occurs every four years. Characteristic of this year if that year is divisible by four then it will not rest or in other words the rest of his equals (zero). Based on these paernyataan we can create programs to determine whether the input year is a leap year or not.
To help get the rest of us can use the modulus (%). Before we make a program, we first create the algorithm. But here I will try to use a little variety. Which separates the BC or after AD. We create the algorithm.
Algorithm leap year
{ determining leap years to the modulus operator}
Deklarasi :
X ← int
Tulis ← string
Deskripsi :
if(x==0) then tulis ← "awal tahun masehi";
else if (x>0 && x % 4 == 0) then tulis ← "tahun kabisat setelah masehi";
else if (x<0 && x % 4 == 0) then tulis ← "tahun kabisat sebelum masehi";
else if (x>0) then tulis ← "bukan tahun kabisat setelah masehi";
else tulis ← "bukan tahun kabisat sebelum masehi";
Once we make the algorithm is time to make the program. The key is that there is in the description we write as a process.
Chekidot friend! Hopefully you know and will be knowledge. Salam SHUPER!