Score:0

Ubuntu codeblocks in release mode bug the output values

pk flag

Well, I've been having problems with compilation on Ubuntu's Codeblocks in release mode. In Debug, as in other IDEs, the output value goes out correctly, but in the release mode it goes like this:

The code is the simple Euclid algorithm to calculate the greatest common divisor (mdc):

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int maioref, menoref, maior, menor, resto, mdc;
    printf("Digite o módulo do maior valor para calcular o mdc:\n");
    scanf("%d", &maioref);
    printf("Digite o módulo do menor valor para calcular o mdc:\n");
    scanf("%d", &menoref);
    maior=maioref;
    menor=menoref;
    while(resto!=0)
    {
        resto=maior%menor;
        maior=menor;
        menor=resto;
    }
    mdc=maior;
    printf("O Mdc entre %d e %d é: %d", maioref, menoref, mdc);
    return 0;
}

The output in the release mode with the values (24;15):

Enter the modulus of the highest value to calculate the mdc:

24

Enter the modulus of the smallest value to calculate the mdc:

15

The Mdc between 24 and 15 is 24

The output in the debug mode with the values (24;15):

Enter the modulus of the highest value to calculate the mdc:

24

Enter the modulus of the smallest value to calculate the mdc:

15

The Mdc between 24 and 15 is 3

What is wrong? (obs: sorry for bad english)

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.