Sum to N
Lektion 9 von 32 im Kurs Programmieraufgaben von Coddy.
Aufgabe
EinfachSchreibe ein Programm, das eine natürliche Zahl N als Eingabe erhält und die Summe der ersten N natürlichen Zahlen ausgibt:
1 + 2 + 3 + 4 + ... + N
Eingabe
4
Ausgabe
10
Eingabe
23
Ausgabe
276
Probier es selbst
#include <stdio.h>
int main() {
// Code hier schreiben
return 0;
}
Alle Lektionen in Programmieraufgaben
1Course Introduction
Introduction2Easy Difficulty
SumEven or OddSquare & CubeMonthsMiddle digitTriangleMathematicsSum to NSum of numbersSortingCircle