===========================================================================
CODING
#include<all.h>
void main()
{
clrscr();
int n,i,n1,q,SUM=0,sum=0;
cout<<"\nEnter how many numbers you want to Enter: ";
cin>>n;
cout<<"\n";
for(i=1;i<=n;i++)
{
cout<<"\nEnter number "<<i<<": ";
cin>>n1;
if(n1>0)
SUM=n1+SUM;
else if(n1<0)
sum=sum+n1;
}
cout<<"\n\nThe Sum of all +ve numbers is: "<<SUM;
cout<<"\n\nThe Sum of all -ve numbers is: "<<sum;
getch();
}
CODING
#include<all.h>
void main()
{
clrscr();
int n,i,n1,q,SUM=0,sum=0;
cout<<"\nEnter how many numbers you want to Enter: ";
cin>>n;
cout<<"\n";
for(i=1;i<=n;i++)
{
cout<<"\nEnter number "<<i<<": ";
cin>>n1;
if(n1>0)
SUM=n1+SUM;
else if(n1<0)
sum=sum+n1;
}
cout<<"\n\nThe Sum of all +ve numbers is: "<<SUM;
cout<<"\n\nThe Sum of all -ve numbers is: "<<sum;
getch();
}
===========================================================================
No comments:
Post a Comment