一、
public class wqw { /**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
double i=9;
double j=0;
System.out.println(j%i);
}}
结果0.0
二、
public class wqw { /**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
double i=9;
double j=0;
System.out.println(i%j);
}}
结果NaN
public class wqw { /**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
double i=9;
double j=0;
System.out.println(j%i);
}}
结果0.0
二、
public class wqw { /**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
double i=9;
double j=0;
System.out.println(i%j);
}}
结果NaN
#include <stdio.h>
int main()
{
double d = 9;
double b = 0;
double rst = d%b;
printf("%f", d%b);
return 0;
}
--------------------Configuration: test - Win32 Debug--------------------
Compiling...
test.cpp
test.cpp(6) : error C2296: '%' : illegal, left operand has type 'double'
test.cpp(6) : error C2297: '%' : illegal, right operand has type 'double'
test.cpp(7) : error C2296: '%' : illegal, left operand has type 'double'
test.cpp(7) : error C2297: '%' : illegal, right operand has type 'double'
Error executing cl.exe.test.obj - 4 error(s), 0 warning(s)