Sunday, 16 March 2025

Program C++ Deret Angka Genap

 #include <iostream>

using namespace std;

int main()

{

 cout << "    Program C++ Deret Angka Genap  " << endl;

 cout << "___________________________________" << endl;

 int titik_akhir, i;

  cout << "Input angka akhir: ";cin >> akhir;

 

 for (i=1; i<=titik_akhir; i++) 

{

   if (i % 2 == 0) {

     cout << i << " ";

   }

 }

 

 cout << endl;

 return 0;

}

No comments:

Post a Comment