Advertisement
satriafu5710

Bilangan Habis dibagi 3 & 5 C++

Dec 5th, 2020
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.36 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.  
  7.     int angka;
  8.  
  9.     cout << "\t Bilangan yang Habis dibagi 3 & 5 \n";
  10.  
  11.     cout << "\n Masukkan Batas Nilai : ";
  12.     cin >> angka;
  13.     cout << endl;
  14.  
  15.     for (int i = 1; i <= angka; i++)
  16.     {
  17.  
  18.         if (i % 3 == 0 && i % 5 == 0)
  19.         {
  20.  
  21.             cout << i << " ";
  22.         }
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement