实验一3
#include "stdafx.h"
#include "math.h"
int main(int argc, char* argv[])
{
double x,y,z;
scanf("%lf,%lf",&x,&y);
if(y>=0)
z=x+1/y;
else
z=x+1/(-y);
printf("%15.6lf\n",z);
printf("%e\n",z);
return 0;
}
#include "stdafx.h"
#include "math.h"
int main(int argc, char* argv[]) {
double x,y,z;
scanf("%lf,%lf",&x,&y);
if(y>=0)
z=x+1/y;
else z=x+1/(-y);
printf("%15.6lf\n",z);
return 0;
}
#include "stdafx.h"
#include "math.h"
int main(int argc, char* argv[])
{
int x,y,z;
scanf("%d,%d",&x,&y);
if(y>=0)
z=x+1/y;
else
z=x+1/(-y);
printf("%d\n",z);
return 0;
}