Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- /*
- * Write a program that prints the first 1000 members of the sequence: 2, -3, 4, -5, 6, -7, …
- * You might need to learn how to use loops in C# (search in Internet).
- */
- class PrintLongSequence
- {
- static void Main()
- {
- int i = 2;
- for (int j = 0; j < 1000; j++)
- {
- if (i % 2 == 0)
- {
- Console.Write(i + "\t");
- i++;
- continue;
- }
- Console.Write(-i + "\t");
- i++;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement