Ask Question
27 January, 13:28

Write a program to read 6 numbers and display the following counts: NPos: the number of posi; ve ones NNeg: the number of nega; ve ones NZero: the number of null ones

+1
Answers (1)
  1. 27 January, 14:58
    0
    Here you go. The program will count entered zeros. Null is not happening here ...

    int main ()

    {

    int NNeg = 0;

    int NPos = 0;

    int NZero = 0;

    std::cout << "Enter 6 numbers:/n";

    for (int i = 0; i < 6; i++) {

    double number;

    std::cin >> number;

    if (number < 0.0) NNeg++;

    else if (number > 0.0) NPos++;

    else NZero++;

    }

    std::cout << "You entered:/n";

    std::cout << NNeg << " negative numbers/n";

    std::cout << NZero << " times zero/n";

    std::cout << NPos << " positive numbers/n";

    }
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write a program to read 6 numbers and display the following counts: NPos: the number of posi; ve ones NNeg: the number of nega; ve ones ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers