Search This Blog

UI/UX Design | Web Development | Mobile Application Development

Whether you need UI/ UX design, web development services, or mobile app development services, Qaabil Digitals will be more than happy to help you. We work with top software developers, designers, and project managers. We tailor our services to suit your exact needs. We closely look at your company, listen to your story, and bring about the best ideas and solutions that can help you drive solid results. We don’t just produce work that works. We produce work that matters. Get a quote now Or Talk to us

Monday 26 September 2011

Java program to find even and odd numbers from 20 numbers (by noor diana)

import java.util.*;
class evenodd
{
public static void main (String args[])
{
Scanner in = new Scanner (System.in);
int a[]= new int[20];
System.out.println ("\n\t You must enter 20 numbers");
for (int i=0;i<20;++i)
{
System.out.print ("\n\t Enter the number = ");
a[i]=in.nextInt();
}

System.out.println ("\n\t Even numbers : ");
for (int i=0;i<20;++i)
{
if (a[i]%2==0)
System.out.println ("\t"+a[i]);
}

System.out.println ("\n\t Odd numbers : ");
for (int i=0;i<20;++i)
{
if (a[i]%2!=0)
System.out.println ("\t"+a[i]);
}

}
}
Share