Advertisement
amrulHarahap

Program Menentukan Kelipatan 3

Nov 27th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main(){
  5.     int awal, akhir;
  6.  
  7.     cout << "------------------------------" << endl;
  8.     cout << "PROGRAM MENENTUKAN KELIPATAN 3" << endl;
  9.     cout << "------------------------------" << endl;
  10.  
  11.     cout << "Masukkan angka awal: ";
  12.     cin >> awal;
  13.     cout << "Masukkan angka akhir: ";
  14.     cin >> akhir;
  15.  
  16.     int i = awal;
  17.     do {
  18.         if (i % 3 == 0){
  19.             cout << i;
  20.             cout << " ";
  21.         }
  22.     i++;
  23.     } while(i <= akhir);
  24.  
  25. }
  26. //source code by: A.M.H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement