-
-
Save parzibyte/5b1cbfea188f72a2ac8702138a1f438e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void serieSuma() { | |
Scanner sc = new Scanner(System.in); | |
System.out.println("Número: "); | |
int numero = sc.nextInt(); | |
sc.close(); | |
int suma = 0; | |
for (int i = 0; i <= numero; i++) { | |
suma += i; | |
} | |
System.out.printf("Suma de los %d primeros números = %d", numero, suma); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment