H
herrcho
i am learning C with 'a book on c' by kelley/pohl
and got stuck in chapter 3 .. here is the code.
#include <math.h>
#include <stdio.h>
main()
{
double x;
while(1)
{
printf("Input x: ");
scanf("%lf",&x);
if(x>=0.0)
printf("\n%15s%22.15e\n%s22.15e\n%15s%22.15e\n\n",
"x = ",x,
"sqrt(x) = ",sqrt(x),
"pow(x,x)=",pow(x,x));
else
printf("\nSorry, your number must be nonnegative.\n\n");
}
}
when i run this and input 1. the value of x shows alright
but it shows 'sqrt(x) = 22.15e'
(null)1.788174022695118e-307'
and when i input 2 or 3 , error window pops up saying 'there is problem
with this executable file'
bythe way i run xp and gcc compiler. could anyone help me please ?
and got stuck in chapter 3 .. here is the code.
#include <math.h>
#include <stdio.h>
main()
{
double x;
while(1)
{
printf("Input x: ");
scanf("%lf",&x);
if(x>=0.0)
printf("\n%15s%22.15e\n%s22.15e\n%15s%22.15e\n\n",
"x = ",x,
"sqrt(x) = ",sqrt(x),
"pow(x,x)=",pow(x,x));
else
printf("\nSorry, your number must be nonnegative.\n\n");
}
}
when i run this and input 1. the value of x shows alright
but it shows 'sqrt(x) = 22.15e'
(null)1.788174022695118e-307'
and when i input 2 or 3 , error window pops up saying 'there is problem
with this executable file'
bythe way i run xp and gcc compiler. could anyone help me please ?