Wednesday, September 22, 2010

menentukan bilangan ganjil dan genap menggunakan C++

#include
#include

 int ganjil( int m)
 {
 int h;
 h=m%2;
 return h;
  }

  int main ()

 {

 int m,n;
 cout<<"masukan bilangan ..";
 cin>>m;

 n=ganjil(m);

 if (n!=0)

 {

 cout<<<" bilangan ganjil";
 }

 else

 {

 cout<<<" bilangan genap";

 }
 }

0 comments:

Post a Comment

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Laundry Detergent Coupons