Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package usandofor;
- import java.util.Scanner;
- public class UsandoFor {
- public static void main(String[] args) {
- // TODO code application logic here
- //declarando variável
- int n1,r = 0;
- Scanner lul = new Scanner (System.in);
- //laço for
- for(int i=0;i<=30;i++){
- System.out.println("Digite aqui um número: ");
- n1 = lul.nextInt();
- r = n1+i;
- }//fim laço for
- // mostrando o resultado
- System.out.println("Sua soma foi de: " + r);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement