diff --git a/Program.cs b/Program.cs index b740b84..667649d 100644 --- a/Program.cs +++ b/Program.cs @@ -4,6 +4,45 @@ class Program { static void Main(string[] args) { - Console.WriteLine("Hello, World!"); + //dichiarazione e inizializzazione variabili + int i, j, num; + ulong fattoriale, fattorialePrec, fattorialeSupporto; + //inizio programma + //input e input sanitization + do{ + Console.Write("Inserire un numero: "); + num=Convert.ToInt32(Console.ReadLine()); + if(num<0){ + Console.WriteLine("Il numero non può essere negativo"); + } + else if(num>65){ + Console.WriteLine("Il numero inserito è troppo grande"); + } + } + while(num<0 || num>65); + //gestione caso 0 + if (num<=1){ + fattoriale=1; + } + else{ + fattoriale=Convert.ToUInt64(num); + //ciclo calcolo fattoriale + Console.WriteLine(fattoriale); + for(i=1; i>num-1; i--){ + //calcolo fattoriale + Console.WriteLine(fattoriale); + Console.WriteLine(i); + fattorialeSupporto=fattoriale; + for(j=i; j>0; j--){ + fattorialePrec=fattoriale; + fattoriale=fattorialeSupporto+fattorialePrec; + Console.WriteLine(fattoriale); + } + //fattoriale=fattoriale*Convert.ToUInt64(i); + } + } + //output finale + Console.Write("Il fattoriale di " +num); + Console.WriteLine(" è " +fattoriale); } } diff --git a/bin/Debug/net8.0/fattoriale_somma b/bin/Debug/net8.0/fattoriale_somma new file mode 100755 index 0000000..cdc14c3 Binary files /dev/null and b/bin/Debug/net8.0/fattoriale_somma differ diff --git a/bin/Debug/net8.0/fattoriale_somma.deps.json b/bin/Debug/net8.0/fattoriale_somma.deps.json new file mode 100644 index 0000000..1e5a1a2 --- /dev/null +++ b/bin/Debug/net8.0/fattoriale_somma.deps.json @@ -0,0 +1,23 @@ +{ + "runtimeTarget": { + "name": ".NETCoreApp,Version=v8.0", + "signature": "" + }, + "compilationOptions": {}, + "targets": { + ".NETCoreApp,Version=v8.0": { + "fattoriale_somma/1.0.0": { + "runtime": { + "fattoriale_somma.dll": {} + } + } + } + }, + "libraries": { + "fattoriale_somma/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + } + } +} \ No newline at end of file diff --git a/bin/Debug/net8.0/fattoriale_somma.dll b/bin/Debug/net8.0/fattoriale_somma.dll new file mode 100644 index 0000000..c222abb Binary files /dev/null and b/bin/Debug/net8.0/fattoriale_somma.dll differ diff --git a/bin/Debug/net8.0/fattoriale_somma.pdb b/bin/Debug/net8.0/fattoriale_somma.pdb new file mode 100644 index 0000000..350376e Binary files /dev/null and b/bin/Debug/net8.0/fattoriale_somma.pdb differ diff --git a/bin/Debug/net8.0/fattoriale_somma.runtimeconfig.json b/bin/Debug/net8.0/fattoriale_somma.runtimeconfig.json new file mode 100644 index 0000000..becfaea --- /dev/null +++ b/bin/Debug/net8.0/fattoriale_somma.runtimeconfig.json @@ -0,0 +1,12 @@ +{ + "runtimeOptions": { + "tfm": "net8.0", + "framework": { + "name": "Microsoft.NETCore.App", + "version": "8.0.0" + }, + "configProperties": { + "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false + } + } +} \ No newline at end of file diff --git a/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs b/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs new file mode 100644 index 0000000..dca70aa --- /dev/null +++ b/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs @@ -0,0 +1,4 @@ +// +using System; +using System.Reflection; +[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")] diff --git a/obj/Debug/net8.0/apphost b/obj/Debug/net8.0/apphost new file mode 100755 index 0000000..cdc14c3 Binary files /dev/null and b/obj/Debug/net8.0/apphost differ diff --git a/obj/Debug/net8.0/fattoriale_somma.AssemblyInfo.cs b/obj/Debug/net8.0/fattoriale_somma.AssemblyInfo.cs new file mode 100644 index 0000000..ed1f406 --- /dev/null +++ b/obj/Debug/net8.0/fattoriale_somma.AssemblyInfo.cs @@ -0,0 +1,22 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +using System; +using System.Reflection; + +[assembly: System.Reflection.AssemblyCompanyAttribute("fattoriale_somma")] +[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] +[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+0069d3f078cae82f4b7d5655a3a2fc1e33fffd20")] +[assembly: System.Reflection.AssemblyProductAttribute("fattoriale_somma")] +[assembly: System.Reflection.AssemblyTitleAttribute("fattoriale_somma")] +[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] + +// Generato dalla classe WriteCodeFragment di MSBuild. + diff --git a/obj/Debug/net8.0/fattoriale_somma.AssemblyInfoInputs.cache b/obj/Debug/net8.0/fattoriale_somma.AssemblyInfoInputs.cache new file mode 100644 index 0000000..5bcf5fc --- /dev/null +++ b/obj/Debug/net8.0/fattoriale_somma.AssemblyInfoInputs.cache @@ -0,0 +1 @@ +cfb584da00f8687aea9ca76bb315194fb261d639221e676583a64cade696674d diff --git a/obj/Debug/net8.0/fattoriale_somma.GeneratedMSBuildEditorConfig.editorconfig b/obj/Debug/net8.0/fattoriale_somma.GeneratedMSBuildEditorConfig.editorconfig new file mode 100644 index 0000000..a03bd22 --- /dev/null +++ b/obj/Debug/net8.0/fattoriale_somma.GeneratedMSBuildEditorConfig.editorconfig @@ -0,0 +1,13 @@ +is_global = true +build_property.TargetFramework = net8.0 +build_property.TargetPlatformMinVersion = +build_property.UsingMicrosoftNETSdkWeb = +build_property.ProjectTypeGuids = +build_property.InvariantGlobalization = +build_property.PlatformNeutralAssembly = +build_property.EnforceExtendedAnalyzerRules = +build_property._SupportedPlatformList = Linux,macOS,Windows +build_property.RootNamespace = fattoriale_somma +build_property.ProjectDir = /home/BrainTheBest5/git/fattoriale_somma/ +build_property.EnableComHosting = +build_property.EnableGeneratedComInterfaceComImportInterop = diff --git a/obj/Debug/net8.0/fattoriale_somma.GlobalUsings.g.cs b/obj/Debug/net8.0/fattoriale_somma.GlobalUsings.g.cs new file mode 100644 index 0000000..8578f3d --- /dev/null +++ b/obj/Debug/net8.0/fattoriale_somma.GlobalUsings.g.cs @@ -0,0 +1,8 @@ +// +global using global::System; +global using global::System.Collections.Generic; +global using global::System.IO; +global using global::System.Linq; +global using global::System.Net.Http; +global using global::System.Threading; +global using global::System.Threading.Tasks; diff --git a/obj/Debug/net8.0/fattoriale_somma.assets.cache b/obj/Debug/net8.0/fattoriale_somma.assets.cache new file mode 100644 index 0000000..44451eb Binary files /dev/null and b/obj/Debug/net8.0/fattoriale_somma.assets.cache differ diff --git a/obj/Debug/net8.0/fattoriale_somma.csproj.CoreCompileInputs.cache b/obj/Debug/net8.0/fattoriale_somma.csproj.CoreCompileInputs.cache new file mode 100644 index 0000000..7fa26e0 --- /dev/null +++ b/obj/Debug/net8.0/fattoriale_somma.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +6c9c825c2579b5c9df4d007cf9d08d59cd8450d1aa17137a0ad456c34e3bc6b7 diff --git a/obj/Debug/net8.0/fattoriale_somma.csproj.FileListAbsolute.txt b/obj/Debug/net8.0/fattoriale_somma.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..4445171 --- /dev/null +++ b/obj/Debug/net8.0/fattoriale_somma.csproj.FileListAbsolute.txt @@ -0,0 +1,14 @@ +/home/BrainTheBest5/git/fattoriale_somma/obj/Debug/net8.0/fattoriale_somma.GeneratedMSBuildEditorConfig.editorconfig +/home/BrainTheBest5/git/fattoriale_somma/obj/Debug/net8.0/fattoriale_somma.AssemblyInfoInputs.cache +/home/BrainTheBest5/git/fattoriale_somma/obj/Debug/net8.0/fattoriale_somma.AssemblyInfo.cs +/home/BrainTheBest5/git/fattoriale_somma/obj/Debug/net8.0/fattoriale_somma.csproj.CoreCompileInputs.cache +/home/BrainTheBest5/git/fattoriale_somma/bin/Debug/net8.0/fattoriale_somma +/home/BrainTheBest5/git/fattoriale_somma/bin/Debug/net8.0/fattoriale_somma.deps.json +/home/BrainTheBest5/git/fattoriale_somma/bin/Debug/net8.0/fattoriale_somma.runtimeconfig.json +/home/BrainTheBest5/git/fattoriale_somma/bin/Debug/net8.0/fattoriale_somma.dll +/home/BrainTheBest5/git/fattoriale_somma/bin/Debug/net8.0/fattoriale_somma.pdb +/home/BrainTheBest5/git/fattoriale_somma/obj/Debug/net8.0/fattoriale_somma.dll +/home/BrainTheBest5/git/fattoriale_somma/obj/Debug/net8.0/refint/fattoriale_somma.dll +/home/BrainTheBest5/git/fattoriale_somma/obj/Debug/net8.0/fattoriale_somma.pdb +/home/BrainTheBest5/git/fattoriale_somma/obj/Debug/net8.0/fattoriale_somma.genruntimeconfig.cache +/home/BrainTheBest5/git/fattoriale_somma/obj/Debug/net8.0/ref/fattoriale_somma.dll diff --git a/obj/Debug/net8.0/fattoriale_somma.dll b/obj/Debug/net8.0/fattoriale_somma.dll new file mode 100644 index 0000000..c222abb Binary files /dev/null and b/obj/Debug/net8.0/fattoriale_somma.dll differ diff --git a/obj/Debug/net8.0/fattoriale_somma.genruntimeconfig.cache b/obj/Debug/net8.0/fattoriale_somma.genruntimeconfig.cache new file mode 100644 index 0000000..66ee82a --- /dev/null +++ b/obj/Debug/net8.0/fattoriale_somma.genruntimeconfig.cache @@ -0,0 +1 @@ +b2e42e65b493d224fbf3d95564104146baed607c1041aa8f221a66c4ccb3d6d1 diff --git a/obj/Debug/net8.0/fattoriale_somma.pdb b/obj/Debug/net8.0/fattoriale_somma.pdb new file mode 100644 index 0000000..350376e Binary files /dev/null and b/obj/Debug/net8.0/fattoriale_somma.pdb differ diff --git a/obj/Debug/net8.0/ref/fattoriale_somma.dll b/obj/Debug/net8.0/ref/fattoriale_somma.dll new file mode 100644 index 0000000..884329b Binary files /dev/null and b/obj/Debug/net8.0/ref/fattoriale_somma.dll differ diff --git a/obj/Debug/net8.0/refint/fattoriale_somma.dll b/obj/Debug/net8.0/refint/fattoriale_somma.dll new file mode 100644 index 0000000..884329b Binary files /dev/null and b/obj/Debug/net8.0/refint/fattoriale_somma.dll differ