Quantcast
Channel: Microcontrollers, Programming and IoT
Viewing all articles
Browse latest Browse all 1271

Positive and negative number

$
0
0
Hello
I wrote program in c that can be find positive and negative number. after that I am trying to find out how many positive and negative number's are there in array
Code:
#include <stdio.h>

 int main(void)
{
    int i;
    int PositiveNegative[10] = {5,2,-1,4,8,-6,8,-7,9,1};

    for (i = 0; i <10; i++)
    {
        if (PositiveNegative[i]>0)
        {
           printf("Positive number %d \n",PositiveNegative[i]);
        }
        else
        {
           printf("Negative number %d...
Positive and negative number

Viewing all articles
Browse latest Browse all 1271

Trending Articles