Difference between revisions of "Java: Soma de dois números inteiros"

From AdonaiMedrado.Pro.Br
Jump to: navigation, search
 
Line 1: Line 1:
 
<code lang=java>
 
<code lang=java>
 +
import java.util.Scanner;
 +
 
public class Somador
 
public class Somador
 
{
 
{
 
     public static void main(String[] args)
 
     public static void main(String[] args)
 
     {
 
     {
         java.util.Scanner s = new java.util.Scanner(System.in);
+
         Scanner s = new Scanner(System.in);      
         int acumulador=0;
+
         System.out.println(s.nextInt()+s.nextInt());
        for(int x=0;x<10;x++)
+
            acumulador+=s.nextInt();
+
       
+
        System.out.println(acumulador);
+
 
     }
 
     }
 
}
 
}
 
</code>
 
</code>

Latest revision as of 01:00, 14 August 2010

import java.util.Scanner;
 
public class Somador
{
    public static void main(String[] args)
    {
        Scanner s = new Scanner(System.in);        
        System.out.println(s.nextInt()+s.nextInt());
    }
}