Count Number Of Positive ,Negative or Zero Number ic C PRogram Tamil


//To count pos,neg,odd,even numbers in an array
#include<stdio.h>
#include<conio.h>
void main()
{
	int num[10],i,pos=0,neg=0,odd=0,even=0;
	clrscr();
	printf("\n Enter the Elements of the Array :");
	for(i=0;i<=9;i++)
	scanf("%d",&num[i]);
	for(i=0;i<=9;i++)
	{
		num[i]<0?neg++:(pos++);		// Conditional Operators
		num[i]%2?odd++:(even++);
	}
	printf("\n Negative Numbers :%d",neg);
	printf("\n Positive Numbers  :%d",pos);
	printf("\n Odd Numbers :%d",odd);        // www.tutorjoes.com
	printf("\n Even NUmbers :%d",even);
	getch();
}

Login To Download Source Code

Leave a Comment:

Login To Comment

List Of Programs


Goto Examples

Operators

Looping

Number Conversion

Pattern Design

Arrays

Matrix Examples

Sorting Examples

String Function

Change Case

String In C

Maths Functions

User Defined Functions

Recursive Functions

Pointer

Structure

File Concept

Calender Programming