Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

write a program to find the number of even integers and odd
integers in a given array in c language

Answer Posted / ankit kr. sharma

#include<stdio.h>
#include<conio.h>
void main()
{

int a[10],i,neg=0,even=0,odd=0;
printf("Enter the elements for the array:\n");
for(i=0;i<10;i++)
{
scanf("%d",&a[i]);
}
printf("The array is:");
for(i=0;i<10;i++)
{
printf("%d\t", a[i]);
}
for(i=0;i<10;i++)
{
if (a[i]<0)
neg++;
else if(a[i]%2==0)
even++;
else
odd++;
}

printf("\nthe odd no.s in the array are: %d\t",odd);
printf("\nthe negative no.s in the array are: %d\t",neg);
printf("\nthe even no.s in the array are: %d\t",even);
}

Is This Answer Correct ?    10 Yes 11 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can I manipulate strings of multibyte characters?

1109


What is string concatenation in c?

1090


Why do we need functions in c?

1015


What is calloc in c?

1139


Tell me the use of bit field in c language?

1063


What is meant by realloc()?

1138


Explain the properties of union.

1080


What are the types of pointers in c?

1022


What is openmp in c?

1022


Are enumerations really portable?

1022


What is the code for 3 questions and answer check in VisualBasic.Net?

2154


Combinations of fibanocci prime series

1609


Explain can you assign a different address to an array tag?

1044


The difference between printf and fprintf is ?

1280


What is advantage of pointer in c?

1182