Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Program menentukan hasil penjumlahan deret 10 bilangan
- // Task No.1 file 066-P05.pptx
- // Amrul Mubarak Harahap
- // 19T03 - 1901098
- #include <iostream>
- using namespace std;
- int main(){
- int a = 2, b = 20, n, total, i;
- for (int i = a; i <= b ; i+=2){
- cout << i;
- if (i < b){
- cout << " + ";
- }
- }
- cout << " = ";
- n = b/2;
- n = n*(n+1);
- cout << n;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement