0% found this document useful (0 votes)
27 views1 page

Count Even Numbers

This Java code takes user input of array size and elements, counts even numbers in the array and displays them along with total even count.

Uploaded by

vskkavitha786
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views1 page

Count Even Numbers

This Java code takes user input of array size and elements, counts even numbers in the array and displays them along with total even count.

Uploaded by

vskkavitha786
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

import java.util.

Scanner;

class CountEven1
{

public static void main(String[] args)


{
int Size, i, evenCount = 0;
Scanner sc = new Scanner(System.in);

System.out.print(" Please Enter Number of elements in an array : ");


Size = sc.nextInt();

int [] a = new int[Size];

System.out.print(" Please Enter " + Size + " elements of an Array :


");
for (i = 0; i < Size; i++)
{
a[i] = sc.nextInt();
}
System.out.print("\n List of Even Numbers in this Array are :");
for(i = 0; i < Size; i++)
{
if(a[i] % 2 == 0)
{
System.out.print(a[i] +" ");
evenCount++;
}
}
System.out.println("\n Total Number of Even Numbers in this Array = " +
evenCount);
}
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy