Showing posts with label Program menentukan Bilangan ganjil atau genap. Show all posts
Showing posts with label Program menentukan Bilangan ganjil atau genap. Show all posts

Sunday, October 25, 2015

Program sederhana c++ Perulangan "Menentukan Bilangan genap ganjil"

Bahasa C++

#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char** argv) {
int a,b;
cout<<"Masukan nilai: ";cin>>b;
for(a=1; a<=b ;a++)
if(a%2==0)
cout<<a<<" Bilangan Genap"<<endl;
else
cout<<a<<" Bilangan Ganjil"<<endl;
return 0;
}