Created
November 24, 2013 08:53
-
-
Save panser/7624971 to your computer and use it in GitHub Desktop.
level03.lesson06.task03
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; | |
/* Семь цветов радуги | |
Выведи на экран текст: семь цветов радуги. | |
В каждой строке должно быть по три цвета, в последней - один. | |
Цвета разделяй пробелом. | |
*/ | |
public class Solution | |
{ | |
public static void main(String[] args) | |
{ | |
//Напишите тут ваш код | |
System.out.println("семь цветов радуги"); | |
String [] Colors = {"красный", "оранжевый", "жёлтый", "зелёный", "голубой", "синий", "фиолетовый"}; | |
int count = 1; | |
for (String i : Colors) | |
{ | |
if (count % 3 != 0) | |
System.out.print(i + " "); | |
else | |
System.out.println(i + " "); | |
count++; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment