-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
13fdab3
commit 0378c6e
Showing
8 changed files
with
118 additions
and
1 deletion.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
</Project> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
bool IsPrime(int prime) | ||
{ | ||
for (int i = 2; i < Math.Sqrt(prime) + 1; i++) | ||
{ | ||
if (prime % i == 0) | ||
{ | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
|
||
List<int> Numbers = new List<int> | ||
{ | ||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, | ||
52,45,47,79,53,23,25,49 | ||
}; | ||
|
||
Numbers.Where(number => IsPrime(number) == true).OrderByDescending(a => a).ToList().ForEach(Console.WriteLine); | ||
//Numbers.Where(number => IsPrime(number) == true).ToList().ForEach(Console.WriteLine); | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
</Project> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace N23_HT1 | ||
{ | ||
public class Product | ||
{ | ||
public string Name { get; set; } | ||
public int Stars { get; set; } | ||
public int Inventore { get; set; } | ||
|
||
public Product(string name,int stars, int inventory) | ||
{ | ||
Name = name; | ||
Stars = stars; | ||
Inventore = inventory; | ||
} | ||
|
||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using N23_HT1; | ||
|
||
|
||
|
||
var products = new List<Product> | ||
{ | ||
new Product("iPhone 12", 4, 60), | ||
new Product("Samsung Galaxy S21", 4, 75), | ||
new Product("Google Pixel 5", 4, 50), | ||
new Product("OnePlus 9 Pro", 4, 60), | ||
new Product("Xiaomi Mi 11", 4, 80), | ||
new Product("Sony Xperia 1 III", 3, 40), | ||
new Product("LG Wing", 3, 30), | ||
new Product("Motorola Edge+", 3, 35), | ||
new Product("Iphone 14", 5, 10), | ||
new Product("Asus ROG Phone 5", 4, 70) | ||
}; | ||
|
||
products.OrderByDescending(product => product.Stars) | ||
.ThenByDescending(produc => produc.Inventore).Take(5) | ||
.ToList().ForEach(product => Console.WriteLine($"{product.Name} - {product.Inventore} in stock")); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
</Project> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// See https://aka.ms/new-console-template for more information | ||
Console.WriteLine("Hello, World!"); |