1. /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package suma.de.n.numeroscon.pkgfor.stram;
import java.io.*;
/**
*
* @author FEDORA HUMBERTO CALLEJA JUAREZ
*/
public class SumaDeNNumerosconForStram {
/**
* @param args the command line arguments
*/
public static void main(String[] args)throws IOException {
// TODO code application logic here
InputStreamReader abc = new InputStreamReader(System.in);
BufferedReader reader = new BufferedReader (abc);
try
{
int suma=0;
int num =0 ;
System.out.print("ingrese la cantidad de datos :");
double can = Integer.parseInt(reader.readLine());
for(int i=1;i<=can;i++)
{
System.out.print("numero: ");
num += Integer.parseInt(reader.readLine());
suma=num;
}
System.err.println("la suma es: "+suma);
}
catch (IOException | NumberFormatException e)
{
System.err.println("verifique el dato");
}
}
}