ACM_1045_读取float类型,定义double类型

import java.util.Scanner;


public class ACM_1045 {
	
	public static void main(String[] args){
		
		Scanner s = new Scanner(System.in);
		
		while(s.hasNextFloat()){
			
			float a = s.nextFloat();
			//see if float is equal to 0.00
			if(a!=0.00){
				String card_num_str = Card_num(a);
				System.out.println(card_num_str);
			}else{
				break;
			}
		
		}
	}
	
	
	//functions, call by main
	private static String Card_num(float input){
		
		//take care, i should be double type, or 1/i can be a problem
		double i=1;
		double sum = 0;
		while(sum

你可能感兴趣的:(Java_ACM)