Computer Science, asked by 21926, 5 months ago

Edhesive assignment 4,i need the answers

Attachments:

Answers

Answered by anindyaadhikari13
3

Answer:-

This is the required program for the question.

I am writing in Java.

import java.util.*;

class EvenOdd

{

public static void main(String args[])

{

Scanner sc=new Scanner(System.in);

System.out.print("How many numbers do you want to check? ");

int n=sc.nextInt();

int odd=0,even=0;

for(int i=1;i<=n;i++)

{

System.out.print("Enter the number: ");

int a=sc.nextInt();

if(a%2==0)

{

System.out.print(a+ " is even. ");

even++;

}

else

{

System.out.print(a+" is odd.");

odd++;

}

}

System.out.println("You entered "+even+" even number(s).");

System.out.println("You entered "+odd+" odd number(s).");

}

}

Answered by yadavsv09
0

Answer:

edhesive code assignment 4

Similar questions