Login
|
Signup
langref.org
-
csharp
,
clojure
, and
cpp
add..
all
erlang
fantom
fsharp
go
groovy
haskell
java
ocaml
perl
php
python
ruby
scala
Home
All
Solved
Unsolved
Strings
Numbers
Regex
Lists
Maps
Structure
Files
Dates
OOP
Networking
XML
Algorithms
Misc
Parallel
View Problem
Structure
Loops
Perform an action a fixed number of times with a counter
Display the string
"10 .. 9 .. 8 .. 7 .. 6 .. 5 .. 4 .. 3 .. 2 .. 1 .. Liftoff!"
csharp
for (int i = 10; i > 0; i--)
{
Console.Write("{0} .. ", i);
}
Console.WriteLine("Liftoff!");
for (int i = 10; i > 0; i--)
{
Console.Write("{0} .. ", i);
}
Console.WriteLine("Liftoff!");
clojure
(dotimes [i 10]
(print (str (- 10 i) " .. ")))
(println "Liftoff!")
(dotimes [i 10]
(print (str (- 10 i) " .. ")))
(println "Liftoff!")
cpp
C++/CLI .NET 2.0
for(int i = 10; i != 0; --i) Console::Write("{0} .. ", i);
Console::WriteLine("Liftoff!");
using namespace System;
int main()
{
for(int i = 10; i != 0; --i) Console::Write("{0} .. ", i);
Console::WriteLine("Liftoff!");
}
Submit a new solution for
csharp
,
clojure
, or
cpp
There are 19 other solutions in
additional
languages (
erlang
,
fantom
,
fsharp
,
groovy
...)