wap to accept 10 numbers & display the number of odd and
even numbers??
Answer Posted / suman_kotte
void main()
{
int a[10],i,even=0,odd=0;
cout<<"enter 10 num's";
for(i=1;i<=10;i++)
{
cin>>a[i];
}
for(i=1;i<=10;i++)
{
if(a[i]%2==0)
even++;
else
odd++;
}
cout<<"the num of even num"<<even;
cout<<"the num of odd num"<<odd;
}
| Is This Answer Correct ? | 17 Yes | 1 No |
Post New Answer View All Answers
What is c++ code?
In which situation the program terminates before reaching the breakpoint set by the user at the beginning of the mainq method?
What is the oldest programming language?
What is enum class in c++?
What do you mean by late binding?
Explain the properties and principles of oop.
what is the difference between overloading & overriding? give example.
We all know that a const variable needs to be initialized at the time of declaration. Then how come the program given below runs properly even when we have not initialized p?
Should you pass exceptions by value or by reference?
What is #include c++?
What is virtual destructor? What is its use?
Are iterators pointers?
Which operations are permitted on pointers?
What is the use of c++ programming language in real life?
Which is best c++ or java?