在java中输入一个数,判断并输出这个数中包含的奇数,偶数和零数字的个数

问题描述:

在java中输入一个数,判断并输出这个数中包含的奇数,偶数和零数字的个数
1个回答 分类:综合 2014-10-17

问题解答:

我来补答
public class Test {
public static void main(String[] arsg){
int temp= 1000009;

String tempStr = 1000009+"";//转换成字符串

int templength = tempStr.length();//获得字符串的长度
int G = 0;//奇数个数
int O = 0;//偶数个数
int zero = 0;//o的个数

int flag = 0;

for(int i = 0;i
 
 
展开全文阅读
剩余:2000