This commit is contained in:
Geir Okkenhaug Jerstad 2024-11-14 11:18:00 +01:00
parent 343a9bc318
commit 907cd1a608
5 changed files with 54 additions and 17 deletions

View file

@ -2,23 +2,17 @@ namespace ConsoleApp2;
public class NewClass public class NewClass
{ {
private int tall = 1; public static int nummer = 1;
private float desimalTall = 1.0f; public static long langt = 1234567890;
double desimalTall2 = 1.01; public static float flytende = 5.5f;
decimal desimalTall3 = 1.01M; public static decimal desimal = 1.5m;
public static double dobbel = 1.5;
public static string streng = "Bokstaver og ord";
public static char karakter = 'A';
public static bool santUsant = false;
char bokstav = 'A'; public string NumberFive()
string tekst = "Hei";
bool santUsant = true; //eller false
int[] tallArray = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
string[] tekstArray = { "A", "B", "C", "D", "E" };
List<int> ListeMedTall = new List<int>();
public int NumberFive()
{ {
return 5; return "fem";
} }
} }

View file

@ -7,7 +7,11 @@ internal class Program
Console.WriteLine("Hei, hva heter du?"); Console.WriteLine("Hei, hva heter du?");
var input = Console.ReadLine(); var input = Console.ReadLine();
Console.WriteLine($"Velkommen {input}!"); Console.WriteLine($"Velkommen {input}!");
Console.WriteLine(NewClass.bokstav); Console.WriteLine($"{NewClass.nummer}");
Console.WriteLine($"{NewClass.flytende}");
Console.WriteLine($"{NewClass.desimal}");
Console.WriteLine($"{NewClass.dobbel}");
Console.WriteLine($"{NewClass.streng}");
} }
} }

View file

@ -0,0 +1,16 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp3", "ConsoleApp3\ConsoleApp3.csproj", "{0F0F3523-8CAA-4458-BC02-5F3BF326548F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0F0F3523-8CAA-4458-BC02-5F3BF326548F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0F0F3523-8CAA-4458-BC02-5F3BF326548F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0F0F3523-8CAA-4458-BC02-5F3BF326548F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0F0F3523-8CAA-4458-BC02-5F3BF326548F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View file

@ -0,0 +1,13 @@
namespace ConsoleApp3
{
internal class Program
{
static void Main(string[] args)
{
int a = 3;
decimal b = 5;
decimal sum = a + b;
Console.WriteLine(sum);
}
}
}