Menghitung ganjil dan genap
#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
void genap_ganjil(int bil){
cout<<bil<<" adalah bilangan ";
if(bil%2==0)
cout<<"genap";
else
cout<<"ganjil";
}
int main(int argc, char** argv) {
int bil;
cout<<"masukkan bilangan: "; cin>>bil;
genap_ganjil(bil);
return 0;
}
No comments:
Post a Comment