Biyernes, Enero 13, 2012

Basic Act : 4 get the most getvaluenumber in alp

package sample.program;


import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;


public class SampleProgram {






public static void main(String[] args) throws FileNotFoundException {




File file =new File("yahoo/yahoo.in");
Scanner scanner =new Scanner(file);


while(scanner.hasNext()){
String [] inputs=scanner.nextLine().split(" ");
int[] mgaNumero=new int [inputs.length];
int kabuangan = 0;
String criminal="";


for(int index =0; index<inputs.length;index++){
int sum = 0;
for(int index2=0;index2<(inputs[index].length());index2++){
mgaNumero[index]= Character.getNumericValue(inputs[index].charAt(index2))-9;
sum+=mgaNumero[index];
};
if(sum>kabuangan){
kabuangan =sum;
criminal = inputs[index];
}
}
System.out.println(criminal); 
}
}


}

Walang komento:

Mag-post ng isang Komento