[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Mails & mails



On Sat, Sep 13, 2014 at 01:38:53AM -0400, Björn Djisktra wrote:
>    Is this gonna work? Please, help.

debian-user is not an arbitrary language parser. Try writing your code
to a file and then applying the compiler/interpreter appropriate to the
language you're writing in to that file. If there are no error messages
resulting from that, then you can assume that yes, it did work.

> 
>    algorithm 10.6
>    type array [1..1000] of integer: arr
>    var
>    arr : a, b, c, d
>    integer : I, J, K, M, n, aux, low, upp, central, cont, big, f_n, num
>    boolean : flag
> 
>    begin
>    do
>    read (n)
>    while (n <= 0) OR (n > 1000)
> 
>    for I <- (1 to n) do:
>    repeat
>    read (a [I])
>    until (a [I] > 0) AND (a [I] < 100) end_for
> 
>    flag <- 'F'
>    I <- 1
>    while (flag == 'F') AND (I < n) do: flag <- 'T'
>    for I <- (1 to (n - I)) do:
>    if (a [I] > a [I + 1] then:
>    aux <- a [I]
>    a [I] <- a [I + 1]
>    a [I + 1] <- aux
>    flag <- 'F'
>    end_if
>    end_for
>    I <- I + 1
>    end_while
> 
>    for I <- (1 to n) do:
>    write (a [I])
>    end_for
> 
>    low <- 1
>    upp <- n
>    central <- ((upp - low) DIV 2) + low
>    write (a [central])
>    M <- 1
>    J <- 1
>    K <- 1
>    for I <- (1 to n) do:
>    if (a [I] < 30) then:
>    b [J] <- a [I]
>    J <- J + 1
>    else:
>    if (a [I] > 70) then:
>    c [K] <- a [I]
>    K <- K + 1
>    else:
>    d [M] <- a [I]
>    M <- M + 1
>    end_if
>    end_if
>    end_for
> 
>    write ('Numbers smaller than 30: ')
>    for I <- (1 to J) do:
>    write (b [I])
>    end_for
> 
>    write ('Numbers larger than 70: ')
>    for I <- (1 to K) do:
>    write (c [I])
>    end_for
> 
>    write ('Numbers between 30 and 70: ')
>    for I <- (1 to M) do:
>    write (d [I])
>    end_for
> 
>    I <- 1
>    f_n <- a [I]
>    cont <- 0
>    big <- 1
>    for I <- (1 to n) do:
>    for J <- (1 to n) do:
>    if (a [J] == f_n) then:
>    cont <- cont + 1
>    end_if
>    if (cont > big) then:
>    big <- cont
>    num <- a [I]
>    end_if
>    end_for
>    f_n <- a [I + 1]
>    cont <- 0
>    end_for
> 
>    write ('The number ', num, ' appears ', big, ' times.'
> 
>    end
> 
>    On Sep 13, 2014 5:25 AM, "Björn Djisktra" <[1]amailuser.14@gmail.com>
>    wrote:
> 
>      Guyz, Stop re-directed mails to my address.
> 
> References
> 
>    Visible links
>    1. mailto:amailuser.14@gmail.com

Attachment: signature.asc
Description: Digital signature


Reply to: