Tuesday, March 5, 2013

C Language Example # 31 Find out odd and even numbers from Array

C Language Example # 31 Find out odd and even numbers from Array 

* Program will find total number of odd numbers and total number of even numbers from array.

//Written by Latest Technology Guide    
//Title : C Language Example # 
31 Find out odd and even numbers from Array 

#include <stdio.h>
#include <conio.h>
void main()
{
clrscr();
int a[10]={0},i,sum=0,od=0,ev=0;

printf("\n Now Enter Value for Array A : \n");

for(i=0;i<10;i++)
{
printf("a[%d] = ",i);
scanf("%d",&a[i]);
}

for(i=0;i<10;i++)
{
if(a[i]%2==1)
od=od+1;
}
printf("\n\n\t\t : Odd Number is : %d",od);

for(i=0;i<10;i++)
{
if(a[i]%2==0)
ev=ev+1;
}
printf("\n\n\t\t : Even Number is : %d",ev);

getch();
}


Output:

* Program will display total number of odd numbers and total number of even numbers.

--------------------------------------------------------------------------------
Explanation of C Programming Language Example # 31 Find out odd and even numbers from Array 


* Program will create static array.
* Program will scan value from users and will store into array.
* Program will find total number of odd numbers.
* Program will find total number of even numbers.

Note: All programs are developed and tested using Turbo C++ 3.0 under Windows XP. We just want to provide guidelines to the users. If you are using any other Compiler or other operating system they you need to modify this program as per your requirements. 

8 comments:

  1. thank you for sharing nice article in your blog
    visit
    web tutorial programming
    https://www.welookups.com

    ReplyDelete
  2. Thank you for taking the time and sharing this information with us. It was indeed very helpful and insightful while being straight forward and to the point.
    Selenium training in Chennai

    Selenium training in Bangalore

    ReplyDelete
  3. After reading this web site I am very satisfied simply because this site is providing comprehensive knowledge for you to audience.
    Thank you to the perform as well as discuss anything incredibly important in my opinion. We loose time waiting for your next article writing in addition to I beg one to get back to pay a visit to our website in




    Selenium training in bangalore
    Selenium training in Chennai
    Selenium training in Bangalore
    Selenium training in Pune
    Selenium Online training

    ReplyDelete