C# :: Aufgabe #99 :: Lösung #3
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();
}
}
}
#3
von niknik (1230 Punkte)
- 18.08.2015 um 10:34 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();
}
}
}
Kommentare:
Für diese Lösung gibt es noch keinen Kommentar
Seite 1 von 0
1
