Write a c program to print the even numbers followed by odd
numbers in an array without using additional array
Answer / nitin garg
#include <stdio.h>
#include <conio.h>
#include <string.h>
int main()
{
int num[100],n,i,j;
printf("how many elements you enter
");
scanf("%d",&n);
printf("Enter %d elements
",n);
for(i=0;i<n;i++)
{
scanf("%d",&num[i]);
}
printf("
print the even numbers followed by odd
numbers
");
for(i=0;i<n;i++)
{
if(num[i]%2==0 && num[i+1]%2!=0)
printf("%d
",num[i]);
}
getch();
}
Output:
how many elements you enter
10
Enter 10 elements
2
4
6
8
10
12
14
16
18
19
print the even numbers followed by odd
numbers
18
Is This Answer Correct ? | 0 Yes | 1 No |
What is the difference between union and structure in c?
Is c pass by value or reference?
What is a shell structure examples?
what is pointer ?
10 Answers Kernex Micro Systems,
What is your stream meaning?
a parameter passed between a calling program and a called program a) variable b) constant c) argument d) all of the above
What is the diffrent between while and do while statement ?
while loop contains parts a) initialisation, evalution of an expression,increment /decrement b) initialisation, increment/decrement c) condition evalution d) none of the above
how to calculate the time complexity of a given algorithm? pls give exaples..mainly for the coplexities such as O(log n),O(n log n)...
change to postfix a/(b+c*d-e)
what does ‘#include’ mean?
Why do u use # before include in a C Progam?