Breaking News
Loading...
Kamis, 21 Januari 2016

Menampilkan Bilangan Ganjil dan Genap dari 1-30 Dalam C++


Berikut Ini adalah kodenya :

 #include <iostream>

using namespace std;

void main(){
       cout << "================================================" << endl;
       cout << "== Program menampilkan Bilangan Ganjil dan Genap dari 1 - 30 ==" << endl;
       cout << "===========================================" << endl << endl;

       int i;

       cout << "Bilangan ganjil : " << endl;
       for(i=1;i<=30;i++){
              if(i%2!=0)cout << i << ", ";
       }

       cout << endl << endl << "Bilangan genap : " << endl;
       for(i=1;i<=30;i++){
              if(i%2==0)cout << i << ", ";
       }
       cout << endl << endl<<endl;

       system("pause");
}




1 komentar:

:) :)) ;(( :-) =)) ;( ;-( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ $-) (b) (f) x-) (k) (h) (c) cheer
Click to see the code!
To insert emoticon you must added at least one space before the code.

 
Toggle Footer