68 382
Assignments Done
Successfully Done
In November 2018

Answer to Question #60048 in C++ for sajid

Question #60048
Q. Write a program that counts the number of 0, odd or even number.
Expert's answer
#include <iostream>

int main()
int number, odd=0, even=0, zeros=0;

std::cout << "Enter numbers (111111 - the end of input)\n";
if(number==0) zeros++;
else if (number % 2) odd++;
else even++;
}while (number!=111111);

std::cout << "\nNumber of 0: " <<zeros
<< "\nNumber of odd numbers (without 111111): "<< --odd
<< "\nNumber of even number: "<< even;
return 0;

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions