wap to accept 10 numbers & display the number of odd and
even numbers??



wap to accept 10 numbers & display the number of odd and even numbers??..

Answer / 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

More C++ General Interview Questions

What is a conversion constructor?

1 Answers  


What is the copy-and-swap idiom?

0 Answers  


What is the difference between reference and pointer?

0 Answers  


What are Binay tress and B trees? Diff between them?

8 Answers   CTS, GATE, Wipro,


Explain "const" reference arguments in function?

0 Answers  






Difference between static global and global?

16 Answers   Microsoft, Symphony, Wipro,


What is abstraction with real time example?

0 Answers  


What is oop in c++?

0 Answers  


What are the types of container classes?

0 Answers  


You have to take 2 arrays of length 10. Input the values of array 1 from the user. Then copy the values of array 1 to array 2 in ascending order For example if user enters 9, 5, 6, 8, 1, 0, 2, 7, 4, 3 then copy the smallest element i.e. 0 first followed by 1, 2 and so

1 Answers  


What is the default width for ouputting a long integer using the insertion operator?

0 Answers  


Evaluate the following expression as C++ would do :8 * 9 + 2 * 5 a) 82 b) 79 c) 370 d) list

0 Answers  


Categories