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 difference between null and nul in c language
write a c programs to do multiplication of two numbers with out using arithmatic operator ??????????
please give me answer with details #include<stdio.h> main() { int i=1; i=(++i)*(++i)*(++i); printf("%d",i); getch(); }
How do you determine if a string is a palindrome?
Why isnt there a numbered, multi-level break statement to break out
How can I automatically locate a programs configuration files in the same directory as the executable?
What do you mean by a sequential access file?
What is the difference between typeof(foo) and myFoo.GetType()?
What is local and global variable in c?
What is return type in c?
count the numbers between 100 and 300, that star with 2 and ends with 2
what is difference between c and c++