To check condition odd even in c++


To check the condition odd even in C++ by using if-else

   #include<iostream.h>
   int main()
{
   int a;

   cout << a <<"enter a character";
 
   cin >>a;

   if (a %2== 0)
 
   cout<<a<<"is even";

   else

   cout<<a<<"is odd";

   return 0;
}

0 comments:

Post a Comment