C# :: Aufgabe #99 :: Lösung #7
12 Lösungen

#99
Zahlen von 1 bis 100 aufaddieren
Anfänger - C#
von Torbo
- 15.05.2015 um 14:38 Uhr

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Gauß { class Program { static void Main(string[] args) { int a = 100; for (int i = 0; i < 1; i++) { a = (a + 1)*a / 2; } Console.WriteLine(a); Console.ReadLine(); } } }
#7

von hobeditz (650 Punkte)
- 05.10.2015 um 13:07 Uhr

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace TYP_Addition { class Program { static void Main(string[] args) { int zahl = 0; for(int i = 1; i <= 100; i++) { zahl += i; } Console.WriteLine(zahl); Console.ReadLine(); } } }
Kommentare:
Für diese Lösung gibt es noch keinen Kommentar
Seite 1 von 0
1