#include <iostream>
using namespace std;
int main()
{
cout << " Program Deret Penjumlahan " << endl;
cout << "______________________________" << endl;
int a, n, total;
cout << "Jumlah deret yang diinginkan: ";cin >> n;
cout << endl;
total = 1;
cout << 1;
for (a = 2; a <= n; a++) {
cout << " + " << a;
total = total + a;
}
cout << " = " << total;
cout << endl;
return 0;
}
No comments:
Post a Comment