Print 5 Sum of Positive Numbers

Description:

Write a C program to find allow the user to enter n number and finds the number of positive numbers entered and the sum of all positive numbers entered using a while loop Input format: Input consists of n+1 integers. The first integer corresponds to n and the next n integers correspond to the numbers to be added.Consider 0 to be a positive number Output format: Refer sample input and output for formatting specifications. Test Case 1 Input (stdin) 4 5 -2 -1 6 Expected Output Positive Numbers=2 Sum=11 Test Case 2 Input (stdin) 5 -1 -2 -3 -4 -5 Expected Output Positive Numbers=0 Sum=0

Program :

#include<stdio.h>

int main(){

  int n,sum=0,count=0,i=1,b;

  scanf("%d",&n);

  while(i<=n)

  {

    scanf("%d",&b);

    i++;

    if(b>=0)

    {

      count++;

      sum=sum+b;

    }

  }

  printf("Positive Numbers=%d\nSum=%d",count,sum);

  return 0;

}