64 701
Assignments Done
99,4%
Successfully Done
In September 2018

Answer to Question #11282 in C# for ajay

Question #11282
How to Create a program in C that accepts a set of integers and finds the number of positive and negative numbers.And the program stops when the user enters 0 for the integer value.
Expert's answer
#include "stdafx.h"
#include <iostream>

using namespace std;
int main()
{
int arrayofnumbers[100];
int number=0;
cin>>number;
int count=0;
while(number!=0){
arrayofnumbers[count]=number;
count++;
cin>>number;
}
cout<<"Positive numbers: ";
for(int i=0;i<count;i++){
if(arrayofnumbers[i]>0){
cout<<arrayofnumbers[i]<<" ";
}
}
cout<<"
Negative numbers: ";
for(int i=0;i<count;i++){
if(arrayofnumbers[i]<0){
cout<<arrayofnumbers[i]<<" ";
}
}
cin>>number;
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!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions