Answer to Question #22581 in C++ for Eddy_ jutt
2013-01-21T12:42:40-05:00
write program that takes n numbers as input. it displays total positive and negative numbers.
1
2013-01-23T08:28:05-0500
#include <conio.h> #include <iostream> using namespace std; void main() { int n; int number; int positiveNumberCount = 0; int negativeNumberCount = 0; cout << "Enter the count of numbers: "; cin >> n; cout << "Enter " << n << " integer numbers:" << endl; for (int c = 0; c < n; c++) { cin >> number; if (number > 0) positiveNumberCount++; if (number < 0) negativeNumberCount++; } cout << endl; cout << "There is " << positiveNumberCount << " positive and " << negativeNumberCount << " negative number(s)." << endl; getch(); }
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 !
Learn more about our help with Assignments:
C++
Comments
Leave a comment