Programming Technique-1

LAB 2

Text

#include<iostream>
#include<conio.h>
using namespace std;

int main()
{
int count;
int positive = 0;
int negative = 0;
float number, AVG;
float sum = 0;

for(count=0; count < 30; ) {

cout<<"PLEASE ENTER A NUMBER:\n ";
cin>>number;

if(number>0) {
positive = positive + 1;
}
else

if(number<0){
negative = negative + 1;
}
else
sum = sum + number;
count= count + 1;
}

AVG= sum/count;
cout<<"positive= "<<positive<<endl;
cout<<"negative= "<<negative<<endl;
cout<<" AVG= "<<AVG;

getch ();



}