Skip to content

Instantly share code, notes, and snippets.

@shcherbakoff
Created April 17, 2015 06:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shcherbakoff/1aac01a38cc63ac5d7ab to your computer and use it in GitHub Desktop.
Save shcherbakoff/1aac01a38cc63ac5d7ab to your computer and use it in GitHub Desktop.
package com.javarush.test.level03.lesson04.task05;
package com.javarush.test.level03.lesson04.task05;
/* Сумма 10 чисел
Вывести на экран сумму чисел от 1 до 10 построчно (должно быть 10 строк):
1
1+2=3
1+2+3=6
1+2+3+4=10
...
Пример вывода:
1
3
6
10
...
*/
public class Solution
{
public static void main(String[] args)
{
int sum = 0;
for(int i=1; i <= 10; i++)
{
sum = sum + i;
System.out.println(sum);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment