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