Witam serdecznie, mam problem z działaniem poniższego programu.
#include <stdio.h>
float dodawanie(float x, float y)
{
return(x+y);
}
float odejmowanie(float x, float y)
{
return(x-y);
}
float mnozenie(float x, float y)
{
return(x*y);
}
float dzielenie(float x, float y)
{
return(x/y);
}
void main(void)
{
float a;
float b;
float c;
int n;
printf("Podaj dwie liczby \n");
scanf("%f", &a);
scanf("%f", &b);
printf("Podaj numer dzialania \n");
scanf("%d", n);
if (n==1)
{
c=dodawanie(a,b);
}
else if(n==2)
{
c=odejmowanie(a,b);
}
else if(n==3)
{
c=mnozenie(a,b);
}
else if(n==4)
{
c=dzielenie(a,b);
}
printf("Wynik=%f\n", c);
}
Program kompiluje sie bez zarzutu jednak po wprowadzeniu danych kończy swoją pracę. Gdzie lezy błąd ?