Created
April 19, 2014 15:27
-
-
Save andreinechaev/11087621 to your computer and use it in GitHub Desktop.
for Ivan
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
package com.javarush.test.level03.lesson06.task03; | |
/* Семь цветов радуги | |
Выведи на экран текст: семь цветов радуги. | |
В каждой строке должно быть по три цвета, в последней - один. | |
Цвета разделяй пробелом. | |
*/ | |
import java.io.BufferedReader; | |
import java.io.InputStreamReader; | |
public class Solution | |
{ | |
public static void main(String[] args) throws Exception | |
{ | |
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); | |
int sum = 0; | |
int add; | |
String text = "сумма"; | |
while (true){ | |
String s = reader.readLine(); | |
if (s.equals(text)) { | |
break; | |
} | |
add = Integer.parseInt(s.trim()); | |
sum += add; | |
} | |
System.out.println(sum); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment