I'm trying to read in values with one function and then do a simple calculation and print the result using second function. In the end the program is going to be more complicated but that's what I started from.
However I ran into problems already. As the result I'm expecting ln(first input number) but that's not what I'm getting. I'm having doubts that the way I do it now wont pass values to second function but I'm not really sure either where the problem is.
That's the code I'm using:
Code:
#include <stdio.h>
#include <math.h>
double sisestus(double, double, double);
double arvutus(double, double);
main(void)
{
double a,b,h;
sisestus(a,b,h);
double summa;
arvutus(a, summa);
printf("Vajuta suvalisele klahvile...");
getch();
return 0;
}
/*Sisestus*/
double sisestus(double s1, double s2, double s3)
{
printf("Sisesta argumendi vähim väärtus.\n");
scanf("%lf",&s1);
printf("Vähim väärtus on %3.2lf\n", s1);
printf("Sisesta argumendi suurim väärtus.\n");
scanf("%lf",&s2);
printf("suurim väärtus on %3.2lf\n", s2);
printf("Sisesta samm.\n");
scanf("%lf",&s3);
printf("Samm on %3.2lf\n", s3);
}
/*Arvutamine*/
double arvutus(double s1, double s2)
{
s2=log(s1);
printf("%lf\n", s2);
}
Any help and explanation is appreciated.