When i am in codeblocks programme works perfectly fine but when i run the standalone exe after you enter first number and then value of the sides it just closes the programme. Thanks in advance for help. Its like it doesnt do the bolded code, just closes after scanf.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
int brojFormule;
float a, b, c;
printf("\n\n\nUnesi broj za formulu koju zelis da koristis.\n");
printf("\n1.Pitagorina teorema\n2.Povrsina pravouglog trougla\n3.Obim trougla\n4.Povrsina kvadrata\n5.Obim kvadrata\n6.Povrsina pravougaonika\n7.Obim pravougaonika\n\n");
scanf("%d", &brojFormule);
if (brojFormule == 1)
{
printf("\nUnesi vrednosti za stranice a i b:");
scanf("%f%f", &a, &b);
printf("c^2=%f\tc=%f\n", pow(a, 2)+pow(b, 2), sqrt(pow(a, 2)+pow(b, 2)));
}
else if (brojFormule == 2)
{
printf("\nUnesi vrednosti za stranice a i b:");
scanf("%f%f", &a, &b);
printf("P=%f\n", (a*b)/2);
}
else if (brojFormule == 3)
{
printf("\nUnesi vrednosti za stranice a,b,c:");
scanf("%f%f%f", &a, &b, &c);
printf("O=%f\n", a+b+c);
}
else if (brojFormule == 4)
{
printf("\nUnesi vrednost stranice a:");
scanf("%f", &a);
printf("P=%f\n", pow(a, 2));
}
else if (brojFormule == 5)
{
printf("\nUnesi vrednost stranice a:");
scanf("%f", &a);
printf("O=%f\n", 4*a);
}
else if (brojFormule == 6)
{
printf("\nUnesi vrednosti za stranice a i b:");
scanf("%f%f", &a, &b);
printf("P=%f\n", a*b);
}
else if (brojFormule == 7)
{
printf("\nUnesi vrednosti za stranice a i b:");
scanf("%f%f", &a, &b);
printf("O=%f\n", 2*(a+b));
}
else{ printf("Uneli ste pogresan broj");}
}