CSharp examples for Language Basics:for
prints the first 10 Fibonacci numbers, where each number is the sum of the previous two
using System;//from w w w. j a v a 2s . c om class Test { static void Main(){ for (int i = 0, prevFib = 1, curFib = 1; i < 10; i++) { Console.WriteLine (prevFib); int newFib = prevFib + curFib; prevFib = curFib; curFib = newFib; } } }