Frequently Asked Java Program 15: Print Even & Odd Numbers from an Array

preview_player
Показать описание
Topic : Print Even & Odd Numbers from an Array

#########################
Udemy Courses:
#########################

Manual Testing+Agile with Jira Tool
************************************

Selenium with Java+Cucumber
********************************

Selenium with Python & PyTest
********************************

Selenium with python using Robot framework
****************************************

API Testing(Postman, RestAssured & SoapUI)
*****************************************

Web & API Automation using Cypress with Javascript
********************************************

Playwright with Javascript
**************************

Jmeter-Performance Testing
************************

SDET Essencials(Full Stack QA)
*************************

Appium-Mobile Automation Testing
************************************

Java Collections
*****************

Python Programming
*********************

Cucumber BDD Framework
***************************

Protractor with Javascript
***************************

####################################
Youtube Playlists:
####################################

Manual Testing & Agile
***********************

SQL
*************************

linux & Shell Scripting
**********************

Java
**********************

Selenium With Java+Cucumber
********************************

Python
********************************

Selenium With Python,Pytest&Behave
***************************************

Selenium With Python Using Robert Framework
(Web&API Testing)
*************************************************

API Testing (Postman,SoapUi,&Rest Assured)
**********************************************

Mobile App Testing Appium
****************************

Performance Testing Jmeter
*******************************

Maven,Jenkins,Git,Github,CI/CD
*******************************

SQL,DB Testing&ETL,Bigdata
*******************************

JavaScript Based Automation Tools
********************************

Selector Hub Tools
********************

GraphQL
******************

Cypress API Testing
********************

Cypress Web Testing
**********************

Playwright with Javascipt
**************************

#JavaEvenOddArray
#ArrayEvenOddJava
#EvenOddNumbers
#ArrayManipulation
#JavaProgramming
#ArrayOperations
#EvenNumbers
#OddNumbers
#ArrayIteration
#JavaArrays
#ProgrammingLogic
#JavaCode
#CodingPractice
#LoopingInJava
#ArrayTraversal
#JavaTips
#JavaTricks
#Algorithm
#JavaDevelopment
#CodeExamples
#JavaLearning
#JavaBasics
#ProgrammingInJava
#CodingInJava
#LogicBuilding
#ArrayPrinting
#JavaFunctions
#EvenOddLogic
#JavaProblemSolving
#ArrayManipulation
#JavaSnippets
#CodingChallenges
#JavaArrays101
#LogicalThinking
#JavaAlgorithms
#ArrayAlgorithms
#JavaHelp
#JavaCommunity
#JavaTricks
#CodeTips
#JavaCoders
#ProgrammingHelp
#JavaSolutions
#ArrayProblems
#JavaPuzzles
#CodeOptimization
#JavaTraining
#LearnJava
#JavaTutorials
#ProgrammingProblems
Рекомендации по теме
Комментарии
Автор

Thank you, now it "clicked" for me :)!

NordicPlan
Автор

I need same program but allow user to enter 10 numbers, and how may it print in descendent values

ezequielbecerrilgonzalez
Автор

Good day sir! What if the numbers were not given at all? how can we do that

hiddled
Автор

What if you want to print the array to the console with only the even numbers?

CaptureSyncVentures
Автор

Thank you sir, I have zero knowledge in coding. very easy understandable. 😀👍🤝

nayabshaik
Автор

sir plz do on video about printing pattern

prasannachukka
Автор

Sir instead of using !=0 we use ==1 in odd numbers if statement

yamunashushma
Автор

Why it's not showing duplicate local variable i

poojak
Автор

what if the pattern is different like {3, 2, 1, 5, 6, 4}? Will it still get the odd and even numbers in any oreder?

godlike
Автор

i have encountered this question in interview and i was not able to give the answer so i was rejected. please guide all type of basic program task question which will be asked in interview.

jnp
Автор

In my interview they asked the below Question, can I get answer for this ....

How can we extract number from each digit and we need digit as a even or odd number

suryakantnulkar
Автор

Sir can we use i<=a.length-1 also right?

gagan
Автор

public class PrintEvenOddNumbersFromArray {
public static void main(String[] args) {
String odd="";
String eve="";


int arr[]={1, 2, 3, 4, 5};
for(int i=0;i<=arr.length-1;i++)
{
if (arr[i]%2==0)
{
eve=eve+arr[i]+" ";

}
else
{
odd=odd+arr[i]+" ";

}
}
System.out.println("Odd numbers are: "+odd);
System.out.println("Even numbers are: "+eve);
}
}

hemmishra
Автор

Can anybody solve thi in O(n) means only using one loop

ddgaming
Автор

Hi Praveen, how to do a pattern program.

pratheepkumar
Автор

public class Even_Odd_from_Array {

public static void main(String args[]) {
int a[] = {2, 3, 4, 5, 6, 7, 8, 9};
List<Integer> even = new ArrayList<Integer>();
List<Integer> odd = new ArrayList<Integer>();

for(int i = 0;i<a.length;i++) {
if(a[i]%2==0) {
even.add(a[i]);
}
else
odd.add(a[i]);
}

System.out.println("Even nummber in the Array = "+ even);
System.out.println("Odd nummber in the Array = "+ odd);
}
}

motivationmotivational
Автор

i tried this way

public static void main(String[] args) {
int a[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
String even = "";
String odd = "";
for(int i = 0; i<a.length; i++)
{
if(a[i]%2==0) {
even = even + " " + a[i];
}
else {
odd = odd +" " +a[i];
}
}
System.out.println("Even no : "+ even +"\nOdd no : "+odd);
}

// Even no : 2 4 6 8 10
// Odd no : 1 3 5 7 9

akshaybachhav