Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Lolcode Program to Calculate the Power of a Number

HAI 1.2
HOW IZ I POWERTWO YR NUM
   BTW RETURN 1 IF 2 TO POWER OF 0
   BOTH SAEM NUM AN 0, O RLY?
   YA RLY, FOUND YR 1
   OIC
  
   BTW CALCULATE 2 TO POWER OF NUM
   I HAS A INDEX ITZ 0
   I HAS A TOTAL ITZ 1
   IM IN YR LOOP UPPIN YR INDEX TIL BOTH SAEM INDEX AN NUM
   TOTAL R PRODUKT OF TOTAL AN 2
   IM OUTTA YR LOOP
  
   FOUND YR TOTAL
   IF U SAY SO
   BTW OUTPUT: 8
   VISIBLE I IZ POWERTWO YR 4 MKAY
KTHXBYE

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.