#include<stdio.h>
#include<conio.h>
main()
{
int
n,i,x,s=0,sum=0;
clrscr();
printf("Enter
the number of terms:\n");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
printf("Enter
the number :\n");
scanf("%d",&x);
if(x>0)
{
s=s+x;
}
else
{
sum=sum-(-x);
}
}
printf("\n\tSum
of Positive numbers is %d\n\tSum of negative numbers is %d",s,sum);
}
No comments:
Post a Comment