Minggu, 17 Agustus 2014

PROGRAM DERET BILANGAN GANJIL GENAP

By Lia Saimin   Posted at  01.22   pemograman No comments


#include <iostream>
#include <conio.h>

using namespace std;

int main()
{
    int n, i;

    cout << "Nama : Angelia Saimin" << endl
         << "NIM  : 13013061" << endl
         << "Kelas: TIR 2.1" << endl;

    cout << "=================================================" << endl;
    cout << " PROGRAM MENAMPILKAN DERET BILANGAN GANJIL GENAP" << endl;
    cout << "=================================================" << endl <<endl;

    cout << "Masukkan nilai ke n = "; cin >> n;
    cout << endl << endl;

    cout << "bilangan" << endl;
    for (i=0; i<=n; i++)
    {
        cout << i << " , ";
    }

    cout << endl << endl;

    cout << "Bilangan Ganjil" << endl;
    for (i=0; i<=n; i++)
    {
        if(i%2!=0)
            cout << i << " , ";
    }
    cout << endl << endl;

    cout << "Bilangan Genap" << endl;
    for (i=0; i<=n; i++)
    {
        if(i%2==0)
            cout << i << " , ";
    }


    getch();
}


About the Author

Nulla sagittis convallis arcu. Sed sed nunc. Curabitur consequat. Quisque metus enim, venenatis fermentum, mollis in, porta et, nibh. Duis vulputate elit in elit. Mauris dictum libero id justo.
View all posts by: BT9

0 komentar:

Back to top ↑
Connect with Us

What they says

© 2013 Angelia Saimin. WP Mythemeshop Converted by Bloggertheme9
Blogger templates. Proudly Powered by Blogger.