C program to count numbers of positive and negative numbers

Write a C program using arrays to count the numbers of positive and negative numbers which accepts the inputs as "size of the array" & "elements of the array" and outputs as "number of negative numbers in an array are" & "numbers of positive numbers in an array are" ?

Showing Answers 1 - 7 of 7 Answers

baseersd

  • Oct 31st, 2007
 

Code
  1. #include

  2. "nEnter the Size of the array");

  3.     scanf("%d""nEnter the elements ::n""%d""nNumber of negative numbers in the array are :: %dn""%d ""nNumber of Positive numbers in the array are :: %dn""%d ",p_nArr[index]);            

  4.            }          

  5.     }

  6.  

  7.     getch();

  8.  

  9. }

  10.  

  11. }




//Note : This program can be solved efficiently using linked list.

  Was this answer useful?  Yes

jintojos

  • Jun 18th, 2008
 

Code
  1.  

  2. #include<stdio.h>

  3. #include<conio.h>

  4. "Enter The Number Of Elements :");

  5.     scanf("%d""Enter The numbers :""%d""nPositive Numbers Are....n"" %d""nNegative Numbers Are....n"" %d",arr[i]);

  6.     getch();

  7.  }

  8.  

  9.  

  Was this answer useful?  Yes

jintojos

  • Jun 18th, 2008
 

Code
  1.  

  2. #include<conio.h>

  3. #include<stdio.h>

  4. "Enter The Number Of Elements :");

  5.       scanf("%d""Enter The Numbers :""%d""The Number Of Positive Numbers Are :%d""The Number Of Negative Numbers Are :%d""Number Of Zeros Are :%d",num-(pos+neg));

  6.       getch();

  7.   }

  8.  

  9.  

  Was this answer useful?  Yes

asdasda

  • Aug 10th, 2013
 

Code
  1. #include<conio.h>

  2. #include<iostream>

  3. "How many values: ""Enter value "<<a<<": "

  Was this answer useful?  Yes

Code
  1. #include<iostream>

  2. #include<stdio.h>

  3. "enter the size of array""enter element of a["<<i<<"]=""total negative numbers "<<count_neg<<" and positive number is "

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions