Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package whilesistema;
- import java.util.Scanner;
- /**
- *
- * @author gabriel.medeiros
- */
- public class WhileSistema {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- // TODO code application logic here
- //declarando variáveis
- int n1,r = 0,cont = 1;
- Scanner xuxa = new Scanner (System.in);
- //fazendo while como laço de repetição
- while (cont <= 30){
- System.out.println("Digite um número: ");
- n1 = xuxa.nextInt();
- r = n1+cont;
- cont ++;
- }
- //fim do laço
- //mostrando o resultado
- System.out.println("O total foi de: " + r);
- } // fim resultado
- } //fim
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement