cesarnascimento

for soma numeros de 1 a 100

May 26th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.28 KB | None | 0 0
  1. package exercicios;
  2.  
  3. public class somatorio {
  4.  
  5.     public static void main(String[] args) {
  6.         int i, soma;
  7.         soma = 0;
  8.         for( i = 1;i <=100; i++){
  9.             soma = soma + i;
  10.             System.out.println(i);
  11.         }
  12.         System.out.println("\nA soma dos numeros de 1 a 100 é: "+soma);
  13.  
  14.     }
  15.  
  16. }
Add Comment
Please, Sign In to add comment