Skip to content

Instantly share code, notes, and snippets.

@rahulsahay19
Created November 6, 2023 16:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rahulsahay19/8378e773063e536187c658071582dbb9 to your computer and use it in GitHub Desktop.
Save rahulsahay19/8378e773063e536187c658071582dbb9 to your computer and use it in GitHub Desktop.
ParallelForExample
using System;
using System.Threading.Tasks;
public class ParallelForExample
{
public static void Main(string[] args)
{
int sum = 0;
Parallel.For(1, 101, i =>
{
sum += i;
});
Console.WriteLine("Sum of numbers from 1 to 100: " + sum);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment