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