Subscribe to Feeds

Send Your COMPLETED Projects To georgepj@hotmail.com

We'll Publish It With Your Name :-)

Programs Can Also Be Downloaded From The Folders Below....[Or Scroll Down]

Sum of Odd +ve & -ve

Click Here To Download C++ File Of This Program

 // Sum of +ve -ve  
//Downloaded From www.c4cpp.co.nr. (C)2009.All rights reserved.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int x,a,n=0,h,i,o=0,d=0;
cout<<"Enter no of nos u want to enter"<<endl;
cin>>h;
for(i=1;i<=h;i++)
{
cin>>a;
if((a>0)&& (a%2!=0))
{
o=o+a;}
if ((a<0) && (a%2!=0))
{n=n+a; }
}
cout<<"Sum of odd negative ="<<n<<endl<<"odd +ve ="<<o;
getch();
}

No comments: