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 |
C,c++, Java is all are structural oriented or procedure oriented language..?
What do you mean by c?
What is console in c language?
can anyone proide me reading material on svit00ef27@yahoo.com please thanx in advance
FILE PROGRAMMING
What is oops c?
What is the difference between typeof(foo) and myFoo.GetType()?
What is alloca() and why is its use discouraged?
What are the applications of c language?
What is the benefit of using const for declaring constants?
What type of function is main ()?
What is the c language function prototype?