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

Compile and Execute Haskell Online

{- Somatório em C
int somatorio(int i, int n) {
    int soma = 0;
    int k;
    
    for(k=i;k < n; k++) {
        soma = soma + i;
    }

    return soma;
-}

somatorio::Int->Int->Int
somatorio i n = sum [i..n]


var = 100::Int   -- Em C: int var = 100;
var = 44         --       var = 44;



main = print (somatorio 1 99)

Advertisements
Loading...

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