Computer Science, asked by roshini7134, 1 year ago

Write a program to input any 50 numbers including positive and negative perform the following task
1 count the positive number
2 count the negative number
3 sum of positive number
4 Sum of negative number

Answers

Answered by piyushatre29
11

#include<stdio.h>

#include<conio.h>

void main()

{

clrscr():

int a[50],i,sumpositive=0,sumnegative=0,countnegative=0,countpositive=0;

printf("enter the 50 number");

for(i=0;i<50;i++)

{

scanf("%d",&a[i]);

}

for(i=0;i<50;i++)

{

if(a[i]<=0)

{

countnegative++;

sumnegative=sumnegative+a[i];

}

else

if(a[i]>=0)

{

countpositive++;

sumpositive=sumpositive+a[i];

}

}

printf("\the number  of positive number you entered is %d",countpositive);

printf("\the sum of positive number u entered is%d",sumpositive);

printf("\nthe number of negative numbered you entered is %d",countnegative);

printf("\nthe sum of negative number you entered is %d",sumnegative);

getch();

}


i hope it will help u ..;.

if it is helpful and liked by you please mark as brainleist

thank you :-)

Similar questions