Computer Science, asked by devashish6309, 11 months ago

Count positive and negativewrite a c program to that allows the user to enter 'n' numbers and finds the number of positive numbers entered and the number of negative numbers

Answers

Answered by sswaraj04
1

Answer:

Explanation:

#include <stdio.h>

int main()

{

int n=6;    //no of integers

int countp=0,countn=0,k;    //countp counts positive ,countn counts negative no.

for(k=1;k<=n;k++)

{

int num;

printf("Enter %dth number",k);

scanf("%d",&num);

if(num>0)

countp++;

if(num<0)

countn++;

}

printf("total number of positive integers is %d and negative numbers is %d",countp,countn);

return 1;

}

Similar questions