- #1
DomBrown2406
- 3
- 0
I'm relatively new to C programming and I am trying to make a program to take and print the natural log of a number input by the user but for some reason my program always returns incorrect answers. For example I entered 1 as my number, and the answer came back as some ridiculously big value which is clearly wrong as I know that ln 1 = 0.
My source code is given below, any help would be greatly appreciated :)
My source code is given below, any help would be greatly appreciated :)
Code:
#include <stdio.h>
#include <math.h>
int main(void)
{
float in;
float out;
do {
printf("Enter the number to take ln of...\n");
scanf("%f", &in);
out = log(in);
printf("Ln of %f is %f\n", &in, &out);
printf("If you want to do this again press 1, if not press any other number\n");
getchar();}
while(1==1);
}
Last edited: