SlideShare a Scribd company logo
1 of 2
Download to read offline
Assume you have a scanner object (called input).
Declare an integer variable (call it value);
initialize the variable with an input from the user;
check if the variable (value)is even or not;
finally, print proper message such as “value is even” or “ value is odd”.
Solution
// Numbers.java
import java.util.*;
public class Numbers {
public static void main(String args[])
{
// scanner object (called input).
Scanner input = new Scanner(System.in);
// Declare an integer variable (call it value);
int value;
// initialize the variable with an input from the user;
System.out.print("Enter a number: ");
value = input.nextInt();
// check if the variable (value)is even or not;
if(value %2 == 0)
System.out.println(value + " is even");
else
System.out.println(value + " is odd");
}
}
/*
output:
Enter a number: 5
5 is odd
Enter a number: 4
4 is even
*/

More Related Content

Similar to Assume you have a scanner object (called input).Declare an integer.pdf

Prompt a user to enter a series of integers separated by spaces and .pdf
Prompt a user to enter a series of integers separated by spaces and .pdfPrompt a user to enter a series of integers separated by spaces and .pdf
Prompt a user to enter a series of integers separated by spaces and .pdfFootageetoffe16
 
MagicSquareTest.java import java.util.Scanner;public class Mag.pdf
MagicSquareTest.java import java.util.Scanner;public class Mag.pdfMagicSquareTest.java import java.util.Scanner;public class Mag.pdf
MagicSquareTest.java import java.util.Scanner;public class Mag.pdfanjanacottonmills
 
Digits.javapackage week04;import java.util.Scanner; public cla.pdf
Digits.javapackage week04;import java.util.Scanner; public cla.pdfDigits.javapackage week04;import java.util.Scanner; public cla.pdf
Digits.javapackage week04;import java.util.Scanner; public cla.pdfannapurnnatextailes
 
Write a Java ProgramSolutionAnswer- Code- import java-io--- import jav.docx
Write a Java ProgramSolutionAnswer- Code- import java-io--- import jav.docxWrite a Java ProgramSolutionAnswer- Code- import java-io--- import jav.docx
Write a Java ProgramSolutionAnswer- Code- import java-io--- import jav.docxlez31palka
 
SumNumbers.java import java.util.Scanner;public class SumNumbe.pdf
SumNumbers.java import java.util.Scanner;public class SumNumbe.pdfSumNumbers.java import java.util.Scanner;public class SumNumbe.pdf
SumNumbers.java import java.util.Scanner;public class SumNumbe.pdfankkitextailes
 
Lab01.pptx
Lab01.pptxLab01.pptx
Lab01.pptxKimVeeL
 
Objective Min-heap queue with customized comparatorHospital emerg.pdf
Objective Min-heap queue with customized comparatorHospital emerg.pdfObjective Min-heap queue with customized comparatorHospital emerg.pdf
Objective Min-heap queue with customized comparatorHospital emerg.pdfezhilvizhiyan
 
KOLEJ KOMUNITI - Sijil Aplikasi Perisian Komputer
KOLEJ KOMUNITI - Sijil Aplikasi Perisian KomputerKOLEJ KOMUNITI - Sijil Aplikasi Perisian Komputer
KOLEJ KOMUNITI - Sijil Aplikasi Perisian KomputerAiman Hud
 

Similar to Assume you have a scanner object (called input).Declare an integer.pdf (10)

Prompt a user to enter a series of integers separated by spaces and .pdf
Prompt a user to enter a series of integers separated by spaces and .pdfPrompt a user to enter a series of integers separated by spaces and .pdf
Prompt a user to enter a series of integers separated by spaces and .pdf
 
MagicSquareTest.java import java.util.Scanner;public class Mag.pdf
MagicSquareTest.java import java.util.Scanner;public class Mag.pdfMagicSquareTest.java import java.util.Scanner;public class Mag.pdf
MagicSquareTest.java import java.util.Scanner;public class Mag.pdf
 
Digits.javapackage week04;import java.util.Scanner; public cla.pdf
Digits.javapackage week04;import java.util.Scanner; public cla.pdfDigits.javapackage week04;import java.util.Scanner; public cla.pdf
Digits.javapackage week04;import java.util.Scanner; public cla.pdf
 
Computer programming 2 chapter 1-lesson 2
Computer programming 2  chapter 1-lesson 2Computer programming 2  chapter 1-lesson 2
Computer programming 2 chapter 1-lesson 2
 
Write a Java ProgramSolutionAnswer- Code- import java-io--- import jav.docx
Write a Java ProgramSolutionAnswer- Code- import java-io--- import jav.docxWrite a Java ProgramSolutionAnswer- Code- import java-io--- import jav.docx
Write a Java ProgramSolutionAnswer- Code- import java-io--- import jav.docx
 
Java programs
Java programsJava programs
Java programs
 
SumNumbers.java import java.util.Scanner;public class SumNumbe.pdf
SumNumbers.java import java.util.Scanner;public class SumNumbe.pdfSumNumbers.java import java.util.Scanner;public class SumNumbe.pdf
SumNumbers.java import java.util.Scanner;public class SumNumbe.pdf
 
Lab01.pptx
Lab01.pptxLab01.pptx
Lab01.pptx
 
Objective Min-heap queue with customized comparatorHospital emerg.pdf
Objective Min-heap queue with customized comparatorHospital emerg.pdfObjective Min-heap queue with customized comparatorHospital emerg.pdf
Objective Min-heap queue with customized comparatorHospital emerg.pdf
 
KOLEJ KOMUNITI - Sijil Aplikasi Perisian Komputer
KOLEJ KOMUNITI - Sijil Aplikasi Perisian KomputerKOLEJ KOMUNITI - Sijil Aplikasi Perisian Komputer
KOLEJ KOMUNITI - Sijil Aplikasi Perisian Komputer
 

More from ezzi552

Execute the following code and identify the errors in the program. D.pdf
Execute the following code and identify the errors in the program. D.pdfExecute the following code and identify the errors in the program. D.pdf
Execute the following code and identify the errors in the program. D.pdfezzi552
 
Essay question The genomes of lots and lots of organisms (mostly ba.pdf
Essay question The genomes of lots and lots of organisms (mostly ba.pdfEssay question The genomes of lots and lots of organisms (mostly ba.pdf
Essay question The genomes of lots and lots of organisms (mostly ba.pdfezzi552
 
Consider the language L = { anb2n n 0 }.Give an implementation.pdf
Consider the language L = { anb2n  n  0 }.Give an implementation.pdfConsider the language L = { anb2n  n  0 }.Give an implementation.pdf
Consider the language L = { anb2n n 0 }.Give an implementation.pdfezzi552
 
Case Study.You are the Chair of the Department of Surgery at a lar.pdf
Case Study.You are the Chair of the Department of Surgery at a lar.pdfCase Study.You are the Chair of the Department of Surgery at a lar.pdf
Case Study.You are the Chair of the Department of Surgery at a lar.pdfezzi552
 
An Unsorted Type ADT is to be extended by the addition of function S.pdf
An Unsorted Type ADT is to be extended by the addition of function S.pdfAn Unsorted Type ADT is to be extended by the addition of function S.pdf
An Unsorted Type ADT is to be extended by the addition of function S.pdfezzi552
 
alue 0.83 points M7-6 Calculating Cost of Goods Available for Sale, E.pdf
alue 0.83 points M7-6 Calculating Cost of Goods Available for Sale, E.pdfalue 0.83 points M7-6 Calculating Cost of Goods Available for Sale, E.pdf
alue 0.83 points M7-6 Calculating Cost of Goods Available for Sale, E.pdfezzi552
 
1)Using general mass-media (such as news sites) identify a recent co.pdf
1)Using general mass-media (such as news sites) identify a recent co.pdf1)Using general mass-media (such as news sites) identify a recent co.pdf
1)Using general mass-media (such as news sites) identify a recent co.pdfezzi552
 
1. The notion that two network exist in the brain, one for emotional.pdf
1. The notion that two network exist in the brain, one for emotional.pdf1. The notion that two network exist in the brain, one for emotional.pdf
1. The notion that two network exist in the brain, one for emotional.pdfezzi552
 
Which of the following is a bank liabilityA. Reserve deposits at .pdf
Which of the following is a bank liabilityA. Reserve deposits at .pdfWhich of the following is a bank liabilityA. Reserve deposits at .pdf
Which of the following is a bank liabilityA. Reserve deposits at .pdfezzi552
 
What was Eisenhower’s reinsurance plan What was Eisenhower’s r.pdf
What was Eisenhower’s reinsurance plan What was Eisenhower’s r.pdfWhat was Eisenhower’s reinsurance plan What was Eisenhower’s r.pdf
What was Eisenhower’s reinsurance plan What was Eisenhower’s r.pdfezzi552
 
What does the following program do What’s its time complexity Just.pdf
What does the following program do What’s its time complexity Just.pdfWhat does the following program do What’s its time complexity Just.pdf
What does the following program do What’s its time complexity Just.pdfezzi552
 
What is not true about the membranes of prokaryotic organism a. The.pdf
What is not true about the membranes of prokaryotic organism  a. The.pdfWhat is not true about the membranes of prokaryotic organism  a. The.pdf
What is not true about the membranes of prokaryotic organism a. The.pdfezzi552
 
What behavior characteristics are associated with each of the four s.pdf
What behavior characteristics are associated with each of the four s.pdfWhat behavior characteristics are associated with each of the four s.pdf
What behavior characteristics are associated with each of the four s.pdfezzi552
 
What are someways to better understand accounting There is a lot of.pdf
What are someways to better understand accounting There is a lot of.pdfWhat are someways to better understand accounting There is a lot of.pdf
What are someways to better understand accounting There is a lot of.pdfezzi552
 
Based on the elements from the Ruby Payne readings create a resource.pdf
Based on the elements from the Ruby Payne readings create a resource.pdfBased on the elements from the Ruby Payne readings create a resource.pdf
Based on the elements from the Ruby Payne readings create a resource.pdfezzi552
 
The answer has to be original.For this week’s discussion, complete.pdf
The answer has to be original.For this week’s discussion, complete.pdfThe answer has to be original.For this week’s discussion, complete.pdf
The answer has to be original.For this week’s discussion, complete.pdfezzi552
 
6. Establishing priorities is an issue that local governments strugg.pdf
6. Establishing priorities is an issue that local governments strugg.pdf6. Establishing priorities is an issue that local governments strugg.pdf
6. Establishing priorities is an issue that local governments strugg.pdfezzi552
 
Suppose that A and B are attributes of a certain relational table. G.pdf
Suppose that A and B are attributes of a certain relational table. G.pdfSuppose that A and B are attributes of a certain relational table. G.pdf
Suppose that A and B are attributes of a certain relational table. G.pdfezzi552
 
RHCE is least associated with which Rh group (D--, R1r, Ror, Rzy) .pdf
RHCE is least associated with which Rh group (D--, R1r, Ror, Rzy) .pdfRHCE is least associated with which Rh group (D--, R1r, Ror, Rzy) .pdf
RHCE is least associated with which Rh group (D--, R1r, Ror, Rzy) .pdfezzi552
 
Question 17 The internal and external environmental factors that su.pdf
Question 17 The internal and external environmental factors that su.pdfQuestion 17 The internal and external environmental factors that su.pdf
Question 17 The internal and external environmental factors that su.pdfezzi552
 

More from ezzi552 (20)

Execute the following code and identify the errors in the program. D.pdf
Execute the following code and identify the errors in the program. D.pdfExecute the following code and identify the errors in the program. D.pdf
Execute the following code and identify the errors in the program. D.pdf
 
Essay question The genomes of lots and lots of organisms (mostly ba.pdf
Essay question The genomes of lots and lots of organisms (mostly ba.pdfEssay question The genomes of lots and lots of organisms (mostly ba.pdf
Essay question The genomes of lots and lots of organisms (mostly ba.pdf
 
Consider the language L = { anb2n n 0 }.Give an implementation.pdf
Consider the language L = { anb2n  n  0 }.Give an implementation.pdfConsider the language L = { anb2n  n  0 }.Give an implementation.pdf
Consider the language L = { anb2n n 0 }.Give an implementation.pdf
 
Case Study.You are the Chair of the Department of Surgery at a lar.pdf
Case Study.You are the Chair of the Department of Surgery at a lar.pdfCase Study.You are the Chair of the Department of Surgery at a lar.pdf
Case Study.You are the Chair of the Department of Surgery at a lar.pdf
 
An Unsorted Type ADT is to be extended by the addition of function S.pdf
An Unsorted Type ADT is to be extended by the addition of function S.pdfAn Unsorted Type ADT is to be extended by the addition of function S.pdf
An Unsorted Type ADT is to be extended by the addition of function S.pdf
 
alue 0.83 points M7-6 Calculating Cost of Goods Available for Sale, E.pdf
alue 0.83 points M7-6 Calculating Cost of Goods Available for Sale, E.pdfalue 0.83 points M7-6 Calculating Cost of Goods Available for Sale, E.pdf
alue 0.83 points M7-6 Calculating Cost of Goods Available for Sale, E.pdf
 
1)Using general mass-media (such as news sites) identify a recent co.pdf
1)Using general mass-media (such as news sites) identify a recent co.pdf1)Using general mass-media (such as news sites) identify a recent co.pdf
1)Using general mass-media (such as news sites) identify a recent co.pdf
 
1. The notion that two network exist in the brain, one for emotional.pdf
1. The notion that two network exist in the brain, one for emotional.pdf1. The notion that two network exist in the brain, one for emotional.pdf
1. The notion that two network exist in the brain, one for emotional.pdf
 
Which of the following is a bank liabilityA. Reserve deposits at .pdf
Which of the following is a bank liabilityA. Reserve deposits at .pdfWhich of the following is a bank liabilityA. Reserve deposits at .pdf
Which of the following is a bank liabilityA. Reserve deposits at .pdf
 
What was Eisenhower’s reinsurance plan What was Eisenhower’s r.pdf
What was Eisenhower’s reinsurance plan What was Eisenhower’s r.pdfWhat was Eisenhower’s reinsurance plan What was Eisenhower’s r.pdf
What was Eisenhower’s reinsurance plan What was Eisenhower’s r.pdf
 
What does the following program do What’s its time complexity Just.pdf
What does the following program do What’s its time complexity Just.pdfWhat does the following program do What’s its time complexity Just.pdf
What does the following program do What’s its time complexity Just.pdf
 
What is not true about the membranes of prokaryotic organism a. The.pdf
What is not true about the membranes of prokaryotic organism  a. The.pdfWhat is not true about the membranes of prokaryotic organism  a. The.pdf
What is not true about the membranes of prokaryotic organism a. The.pdf
 
What behavior characteristics are associated with each of the four s.pdf
What behavior characteristics are associated with each of the four s.pdfWhat behavior characteristics are associated with each of the four s.pdf
What behavior characteristics are associated with each of the four s.pdf
 
What are someways to better understand accounting There is a lot of.pdf
What are someways to better understand accounting There is a lot of.pdfWhat are someways to better understand accounting There is a lot of.pdf
What are someways to better understand accounting There is a lot of.pdf
 
Based on the elements from the Ruby Payne readings create a resource.pdf
Based on the elements from the Ruby Payne readings create a resource.pdfBased on the elements from the Ruby Payne readings create a resource.pdf
Based on the elements from the Ruby Payne readings create a resource.pdf
 
The answer has to be original.For this week’s discussion, complete.pdf
The answer has to be original.For this week’s discussion, complete.pdfThe answer has to be original.For this week’s discussion, complete.pdf
The answer has to be original.For this week’s discussion, complete.pdf
 
6. Establishing priorities is an issue that local governments strugg.pdf
6. Establishing priorities is an issue that local governments strugg.pdf6. Establishing priorities is an issue that local governments strugg.pdf
6. Establishing priorities is an issue that local governments strugg.pdf
 
Suppose that A and B are attributes of a certain relational table. G.pdf
Suppose that A and B are attributes of a certain relational table. G.pdfSuppose that A and B are attributes of a certain relational table. G.pdf
Suppose that A and B are attributes of a certain relational table. G.pdf
 
RHCE is least associated with which Rh group (D--, R1r, Ror, Rzy) .pdf
RHCE is least associated with which Rh group (D--, R1r, Ror, Rzy) .pdfRHCE is least associated with which Rh group (D--, R1r, Ror, Rzy) .pdf
RHCE is least associated with which Rh group (D--, R1r, Ror, Rzy) .pdf
 
Question 17 The internal and external environmental factors that su.pdf
Question 17 The internal and external environmental factors that su.pdfQuestion 17 The internal and external environmental factors that su.pdf
Question 17 The internal and external environmental factors that su.pdf
 

Recently uploaded

Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 

Recently uploaded (20)

Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 

Assume you have a scanner object (called input).Declare an integer.pdf

  • 1. Assume you have a scanner object (called input). Declare an integer variable (call it value); initialize the variable with an input from the user; check if the variable (value)is even or not; finally, print proper message such as “value is even” or “ value is odd”. Solution // Numbers.java import java.util.*; public class Numbers { public static void main(String args[]) { // scanner object (called input). Scanner input = new Scanner(System.in); // Declare an integer variable (call it value); int value; // initialize the variable with an input from the user; System.out.print("Enter a number: "); value = input.nextInt(); // check if the variable (value)is even or not; if(value %2 == 0) System.out.println(value + " is even"); else System.out.println(value + " is odd"); } } /* output: Enter a number: 5 5 is odd Enter a number: 4