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 c program to print the even numbers followed by odd
numbers in an array without using additional array

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why c is called a middle level language?

1115


What is scanf () in c?

1130


What is linear search?

1141


What is variable declaration and definition in c?

901


Explain how do you convert strings to numbers in c?

1082


What does p mean in physics?

1047


What is dynamic dispatch in c++?

1067


what are # pragma staments?

2047


What is s or c?

1066


write a c program thal will find all sequences of length N that produce the sum is Zero, print all possible solutions?

2871


write a programe to accept any two number and check the following condition using goto state ment.if a>b,print a & find whether it is even or odd and then print.and a

1953


Explain how do you view the path?

1179


What is memory leak in c?

1129


Explain what is the difference between a string and an array?

1174


How can you pass an array to a function by value?

1126