write a program to find the number of even integers and odd
integers in a given array in c language
Answers were Sorted based on User's Feedback
Answer / nikhil patil
#include<stdio.h>
#include<conio.h>main()
{
int a[5],even=0,odd=1,i;
for(i=0;i<5;i++)
scanf("%d",&a[i]);
/* display the number of odd and even intergers */
for(i=0;i<5;i++)
{
if((a[i]%2 ==0))
even++;
if((a[i]%2==1))
odd++;
}
printf("%d",even,);
printf ("%d",odd,);
getch();
| Is This Answer Correct ? | 32 Yes | 44 No |
Answer / april
#include<stdio.h>
#include<conio.h>
using namespace std;
int main();
{
int i,j;
int num[20],i,odd=0,even=0,n;
cout<<("enter the size of the array",n);
cin>>("%d",&n);
cout<<("Enter the %d array elements",n);
for(i=20;i<n;i++);
{
cout<<("%d",&num[i]);
}
for(i=0;i<n;i++);
{
if(num[i]%2==0);
{
even++;
}
else
{
odd++;
}
}
cout<<("\n The number of even numbers in the array :%
d ",even);
cout<<("\n The number of odd numbers in the array : %
d",odd);
getch();
system("pause");
}
| Is This Answer Correct ? | 25 Yes | 37 No |
Answer / jasna.c
#include<stdio.h>
#include<conio.h>
void main()
{
int arr[100],i,odd=0,even=0,n;
printf("enter the size of the array");
scanf("%d",&n);
printf("Enter the %d array elements",n);
for(i=0;i<n;i++)
{
scanf("%d",&arr[i]);
}
for(i=0;i<n;i++)
{
if(arr[i]%2==0)
{
even++;
}
else
{
odd++;
}
}
printf("\n The number of even numbers in the array :%d ",even);
printf("\n The number of odd numbers in the array : %d",odd);
getch();
}
| Is This Answer Correct ? | 26 Yes | 41 No |
Explain what standard functions are available to manipulate strings?
write a function that accepts an array A with n elements and array B with n-1 elements. Find the missing one in array B,with an optimized manner?
for example user gives input as " 20 or 20.0 or rs 20.0 or 20.00 or rs20 and so .. on " and the output should be stored as " rs.20.00 " in a variable
marge linklist
Given an array of characters which form a sentence of words, give an efficient algorithm to reverse the order of the words (not characters) in it?
I just typed in this program, and it is acting strangely. Can you see anything wrong with it?
Dear Sir, we are required the bubble sorting programs Regs Prem
What are the different types of data structures in c?
Explain 'far' and 'near' pointers in c.
What is use of #include in c?
What is the role of this pointer?
Explain what is the benefit of using enum to declare a constant?