How to resolve the algorithm Pangram checker step by step in the Draco programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Pangram checker step by step in the Draco programming language

Table of Contents

Problem Statement

A pangram is a sentence that contains all the letters of the English alphabet at least once. For example:   The quick brown fox jumps over the lazy dog.

Write a function or method to check a sentence to see if it is a   pangram   (or not)   and show its use.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Pangram checker step by step in the Draco programming language

Source code in the draco programming language

proc nonrec pangram(*char s) bool:
    ulong letters;
    char c;
    byte b;
    byte A = pretend('a', byte);
    byte Z = pretend('z', byte);

    letters := 0L0;
    while
        c := s*;
        s := s + 1;
        c /= '\e'
    do
        b := pretend(c, byte) | 32;
        if b >= A and b <= Z then
            letters := letters | 0L1 << (b-A)
        fi
    od;
    letters = 0x3FFFFFF
corp

proc nonrec test(*char s) void:
    writeln("\"", s, "\": ",
            if pangram(s) then "yes" else "no" fi)
corp

proc nonrec main() void:
    test("The quick brown fox jumps over the lazy dog.");
    test("The five boxing wizards jump quickly.");
    test("Not a pangram")
corp

  

You may also check:How to resolve the algorithm Loops/Nested step by step in the Jsish programming language
You may also check:How to resolve the algorithm Real constants and functions step by step in the Elm programming language
You may also check:How to resolve the algorithm Parameterized SQL statement step by step in the Phix programming language
You may also check:How to resolve the algorithm File input/output step by step in the Euphoria programming language
You may also check:How to resolve the algorithm Largest proper divisor of n step by step in the jq programming language