i have been writing this code of odd and even numbers using ternary operator but it is showing "expected primary-expression before ‘?’ token"
{
int n;
cout<<"enter any numbner::";
cin>>n;
if(n%2==0) ? cout<<"no is even::" : cout<<"no is odd::";
return 0;
}
expected o/p is: enter any number:20 no is even::
Aucun commentaire:
Enregistrer un commentaire