write a program to initialise 15 integers in an array the array consists both positive and negative integers print all the integers from the array along with count of all positive and count of all negative integers
Answers
Answered by
3
Explanation:
class abc
{ public static void main(String args[])
{ Scanner sc = newScanner(System.in);
int a = new int[15], even=0, odd=0;
for(i=1; i<=15;i++)
{
System.out.print("Enter a number");
a[i]= sc.nextInt();
}
for(i=1;i<=15;i++)
{
if(a[i]%2==0)
even++;
else
odd++;
}
}
}
Similar questions