How to resolve the algorithm Square but not cube step by step in the LOLCODE programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Square but not cube step by step in the LOLCODE programming language

Table of Contents

Problem Statement

Show the first   30   positive integers which are squares but not cubes of such integers. Optionally, show also the first   3   positive integers which are both squares and cubes,   and mark them as such.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Square but not cube step by step in the LOLCODE programming language

Source code in the lolcode programming language

HAI 1.2

I HAS A SkwareKyoobs ITZ A BUKKIT
I HAS A NumbarSkwareKyoobs ITZ 0
I HAS A NotKyoobs ITZ 0

I HAS A Index ITZ 1
I HAS A Skware ITZ 1
I HAS A Kyoob ITZ 1
I HAS A Root ITZ 1

VISIBLE "Skwares but not kyoobs::"

IM IN YR Outer UPPIN YR Dummy WILE DIFFRINT NotKyoobs AN 30

   Skware R PRODUKT OF Index AN Index

   IM IN YR Inner UPPIN YR OtherDummy WILE DIFFRINT Kyoob AN BIGGR OF Skware AN Kyoob
      Root R SUM OF Root AN 1
      Kyoob R PRODUKT OF PRODUKT OF Root AN Root AN Root
   IM OUTTA YR Inner

   BOTH SAEM Skware AN Kyoob, O RLY?
     YA RLY
       SkwareKyoobs HAS A SRS NumbarSkwareKyoobs ITZ Skware
       NumbarSkwareKyoobs R SUM OF NumbarSkwareKyoobs AN 1
     NO WAI
       BOTH SAEM Kyoob AN BIGGR OF Skware AN Kyoob, O RLY?
         YA RLY
           VISIBLE SMOOSH Skware " " MKAY !
           NotKyoobs R SUM OF NotKyoobs AN 1
       OIC
   OIC


   Index R SUM OF Index AN 1
IM OUTTA YR Outer

VISIBLE ""
VISIBLE ""
VISIBLE "Both skwares and kyoobs::"
IM IN YR Output UPPIN YR Index WILE DIFFRINT Index AN NumbarSkwareKyoobs
  VISIBLE SMOOSH SkwareKyoobs'Z SRS Index " " MKAY !
IM OUTTA YR Output
VISIBLE ""

KTHXBYE

  

You may also check:How to resolve the algorithm Word wheel step by step in the 11l programming language
You may also check:How to resolve the algorithm Command-line arguments step by step in the Objective-C programming language
You may also check:How to resolve the algorithm Date format step by step in the SenseTalk programming language
You may also check:How to resolve the algorithm Josephus problem step by step in the Modula-2 programming language
You may also check:How to resolve the algorithm Main step of GOST 28147-89 step by step in the PicoLisp programming language