#include<iostream.h>
#include<conio.h>
void Count(int arr[], int num);
void main()
{
clrscr();
int n, num[50];
cout<<"How many numbers you want to enter: ";
cin>>n;
for(int i=0; i<n; i++)
{
cout<<"Enter number: ";
cin>>num[i];
}
Count(num , n);
getch();
}
void Count (int arr[], int num)
{
int even, odd, zero;
even = odd = zero = 0;
for(int i= 0; i<num; i++)
{
if(arr[i]%2 == 0 && arr[i]!= 0)
even++;
if(arr[i] %2 != 0)
odd++;
if(arr[i] == 0)
zero++;
}
cout<<"Total numbers of zeros entered: "<<zero<<endl;
cout<<"Total numbers of odds entered: "<<odd<<endl;
cout<<"Total numbers of evens entered: "<<even;
}
#include<conio.h>
void Count(int arr[], int num);
void main()
{
clrscr();
int n, num[50];
cout<<"How many numbers you want to enter: ";
cin>>n;
for(int i=0; i<n; i++)
{
cout<<"Enter number: ";
cin>>num[i];
}
Count(num , n);
getch();
}
void Count (int arr[], int num)
{
int even, odd, zero;
even = odd = zero = 0;
for(int i= 0; i<num; i++)
{
if(arr[i]%2 == 0 && arr[i]!= 0)
even++;
if(arr[i] %2 != 0)
odd++;
if(arr[i] == 0)
zero++;
}
cout<<"Total numbers of zeros entered: "<<zero<<endl;
cout<<"Total numbers of odds entered: "<<odd<<endl;
cout<<"Total numbers of evens entered: "<<even;
}
0 comments:
Post a Comment