Question

Read n numbers. Count the number of negative numbers, positive numbers and zeroes in the list. Use arrays. 

11 Mar 2023
Answer :
Word Count : 463

#include <iostream>

int main() {
    // Declare variables
    int n;

    // Input the number of elements
    std::cout << "Enter the number of elements: ";
    std::cin >> n;

    // Declare an array to store the numbers
    int numbers[n];

    // Input the numbers
    std::cout << "Enter " << n << " numbers:\n";
    for (int i = 0; i < n; ++i) {
        std::cout << "Enter number " << (i + 1) << ": ";
        std::cin >> numbers[i];
    }

    // Initialize counters
    int positiveCount = 0;
    int negativeCount = 0;
    int zeroCount = 0;

    // Iterate through the array to count positive, negative, and zero numbers
    for (int i = 0; i < n;

______ ______ ___ _______ ____ ____ _________ _____ ____ ________.
____ __________ ________ _______ ___ ________ __________.
____ ____ __________ __________ _________ _________.
____ ___ ______ ___ ___ ______.
______ _____ ____ _______ _____ _____ ________.
________ __________ _________ ___ ___ ________ __________ ___.
__________ ________ ____ _________ _____ ______ _________.
_______ ____ ______ ____ __________ _________ ______ ______ ________ ________ _________.
________ ______ ____ ______ ________ ___ _______ _________.
_____ ____ ___ ____ ___ _____ ______ __________.
_________ ________ ____ ____ _____ _____ ____ ______.
__________ _______ ________ _________ ___ ______ _____ __________ _________ ________ _________ ________.
________ ________ ______ ___ ___ ________.
__________ _____ _____ _______ ___ _______ ________ ___ _____ ________.
_____ _______ _______ ___ ____ _____ ____ _____.
_____ _________ _________ _______ ___ _________ _____ ____.
______ _____ ______ ___ _______ _________ _____ ________ __________ __________ ___.
_______ _____ ______ ____ ___ ________ _____ _______ ______.
________ __________ _______ __________ ____ ______ __________.
____ ___ _______ __________ ________ ______ ___ __________ _____.
__________ _______ ____ ________ _______ _____ __________ _______ ____ __________ __________.
_____ __________ _______ _______ __________ ____.
___ ________ __________ ________ ______ __________ _____ _____ _____ __________ ____.
_______ ___ _______ ____ _____ _________ _______ ___ __________ _____.
_______ ________ ________ ________ ____.
__________ ________ ________ ___ ___ __________.
______ ____ ___ ___ _______ __________ _____ _____ ___ ______ _________ ___.
____ ____ ____ _______ ____.
_________ ______ ______ ____ __________ ___.
__________ ________ ______ __________ ____.
_____ ________ _______ _________ __________ ____ ______ ________ ___ _____.
_____ ___ ______ ________ _____ ________ _______ ___ ___ _______ ___.
______ _________ _________ ________ _____ ______.
___ __________ ___ _____ ___ ______ ____.
________ _______ _________ ____ ______ __________ ___ ______ ___.
____ ___ ________ _________ ___ ______.
____ ______ _______ ____.
IGNOU ACADEMY
Your IGNOU journey, made easier.
  • Solved Assignments
  • Study Notes
  • Guess Papers
  • Question Papers
Skip in 10
Top
📞
Call Support Instant phone assistance IGNOU MLIL 7 2023 - Read n numbers. Count the number of negative numbers, positive numbers | IGNOU Academy
→
🟢
WhatsApp Chat Fast live messaging
→
Email Us Business enquiries & support
→