Loops

Loops

Write a program that repeatedly reads an integer from the console. If the integer is odd, outputs ΓΆβ?¬Ε?Odd Day!ΓΆβ?¬Β? if the integer is even (and not 0), outputs ΓΆβ?¬Ε?Even now!ΓΆβ?¬Β?. if the integer is 0. exits program

View Answers

February 10, 2012 at 5:04 PM

import java.util.*;
class EvenOddDay 
{
    public static void main(String[] args) 
    {
        Scanner input=new Scanner(System.in);
        int num=-1;
        while(num!=0){
             System.out.print("Enter Number: ");
              num=input.nextInt();
              if(num==0){
                  System.exit(0);
              }
             if(num%2==0){
                System.out.println("Even Day");
             }
             else{
                System.out.println("Odd Day");
             }
             }

    }
}









Related Tutorials/Questions & Answers:
Loops
Loops  ο??Using for loops, Write a program to simulate a clock countdown. The program prompts the user to enter the number of seconds, displays a message at every second, and terminates when the time expires. Use method
Loops
Loops  Write code that uses nested loops to print the following patterns: Pattern1: 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 1 2 3 4 5 6 Pattern 2: 1 2 3 4 5 6 1 2 3 4 5 1 2 3 4 1 2 3 1 2 1
Advertisements
Loops
Loops  Write code that uses nested loops to print the following patterns: Pattern1: 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 1 2 3 4 5 6 Pattern 2: 1 2 3 4 5 6 1 2 3 4 5 1 2 3 4 1 2 3 1 2 1
Loops
Loops  by using drjava q1.Write code that uses nested loops to print the following patterns: Pattern1: 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 1 2 3 4 5 6 Pattern 2: 1 2 3 4 5 6 1 2 3 4 5 1 2 3 4 1 2 3 1 2 1 q2.Write code
Loops
3.10. Loops Loops are the essential part of the program that have.... More than one loops can be used several times in a script. Loops makes easy... instructed for repetition of the code. PHP Loops ADS_TO_REPLACE_1 In PHP, like other
loops
Loops
Loops
loops
loops
loops
nested for loops
"); } } } }   Close your loops before going
use of loops and screenshots
use of loops and screenshots  1.how to use loops in netbeans? 2.how to draw a correct screenshot
ModuleNotFoundError: No module named 'loops'
ModuleNotFoundError: No module named 'loops'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'loops' How to remove the ModuleNotFoundError: No module named 'loops'
Java - Declaring variables in for loops
Java - Declaring variables in for loops  Java - Declaring variables in for loops
Use javascript loops..
Use javascript loops..  Write a Javascript code to create a redirection script based on day of the week
How to read loops in Java
How to read loops in Java  Example that explains how to read loop in Java
loops , control structures
loops , control structures  a simple java program to print 1 1 2 1 1 2 3 2 1 1 2 3 4 3 2 1
LOOPS - Java Interview Questions
LOOPS   how to find out unique number of elements in given array?{1,2,5,3,2,1,1,7,2,3,0,1,5} output is: 1-4 2-3 3-2 5-2 0-1 7-1 i want source code plz help me
ModuleNotFoundError: No module named 'gevent-loops'
ModuleNotFoundError: No module named 'gevent-loops'  Hi, My Python... 'gevent-loops' How to remove the ModuleNotFoundError: No module named 'gevent-loops' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'gevent-loops'
ModuleNotFoundError: No module named 'gevent-loops'  Hi, My Python... 'gevent-loops' How to remove the ModuleNotFoundError: No module named 'gevent-loops' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'gevent-loops'
ModuleNotFoundError: No module named 'gevent-loops'  Hi, My Python... 'gevent-loops' How to remove the ModuleNotFoundError: No module named 'gevent-loops' error? Thanks   Hi, In your python
pattern-using loops
pattern-using loops  Write a program that displays the following pattern ... (use nested loops) * ** * ** * ** *   the correct pattren
Using Nested loops
Using Nested loops  How to use nested loops in java when I want to print the 10 multiples of numbers 2 to 15(in multiplication table)   public class MultiplicationTable{ public static void main(String[] args) { int
while loop to for loops
while loop to for loops  I have to change this while loops to for loops and I was wondering if you could help me out. I got the codes just need to know how to change it. int currentNum= num1; while(num1>num2
Use javascript loops..
Use javascript loops..  Write a JavaScript code to find a number of unique letters in string. (Eg. if keyword is Tajmahal, Tajmahal count will be '5' , it only takes these letters T,j,m,h,l , not taken the letter a because
Use javascript loops..
Use javascript loops..  Write a Javascript code, so that numbers...--){ document.write(" "); for(var k=q; k>=1;k--){ document.write(" "); } for(var j=1;j<...;"); q++; } document.write("</center>"); </script> ThanksADS
LOOPS !! - Java Interview Questions
LOOPS !!  i have string "Hello" i want to print like H He Hel Hell Hello o ol oll olle olleh i want source code plz help me?  String s="Hello"; System.out.println(s.length()); System.out.println
Arrays, loops and string handling
Arrays, loops and string handling  How would i go about in creating a program to mark and grade a set of multiple choice test results. this is a console program that uses JOptionPane dialog boxes as well. Read a set of 10
read string - using loops in Java
read string - using loops in Java  Write a program to read a string composed of an unknown number of words, then count the number of words in the string, and Display the longest and shortest words, with first letter Uppercase
ModuleNotFoundError: No module named 'viral-loops-api'
ModuleNotFoundError: No module named 'viral-loops-api'  Hi, My... named 'viral-loops-api' How to remove the ModuleNotFoundError: No module named 'viral-loops-api' error? Thanks   Hi, In your python
Solve using only Javascript loops...
Solve using only Javascript loops...  Write a JavaScript code, 1) to find a number of unique letters in string. (Eg. if keyword is unique, Unique count will be '4') 2) so that numbers appear in following format, 1 1 2
iPhone Loops in objective c
iPhone Loops in objective c If you have started learning Objective c, this small tutorial on "Loops in Objective c" would be helpful. In this series... programing then ..you must read the given definition of loops. What is loop
program that uses while loops to perform the following steps :
program that uses while loops to perform the following steps :  Write a program that uses while loops to perform the following steps : a. Prompt the use to input two integers : FirstNum and secondNum.( FirstNum must be less
Java loops
Javascript loops
java loops
nested loops
Nesting of loops
Nesting of loops  Q 1. Write a C Program to draw the following pattern. 11 9 7 5 3 1 9 7 5 3 1 7 5 3 1 5 3 1 3 1
JavaScript Loops Function
JavaScript Loops Types: In Java programming language a loop is a language construct which allows the statements  to execute again and again. Loop can..., and foreach loop. Following examples will help you to learn loops:ADS_TO_REPLACE_1
I need to output number diamond using nested for loops.
I need to output number diamond using nested for loops.  How to i output this using nested for loops 1 131 13531 1357531 135797531 1357531 13531 131 1
Java repeat string without using loops
Java repeat string without using loops In this section, you will learn how to repeat string without using for loops. The given example accepts the number of times and iterates the string to the number of times set by the user without
Java reverse words in a string using only loops
Java reverse words in a string using only loops In this tutorial, you will learn how to reverse words in a string without using any inbuilt methods like split() etc, StringTokenizer functiom or any extra ordinary function Only loops
java loops - Java Beginners
? Q4- Write a program to sum the series- 2/9-5/13+8/17......... Q 5
java loops - Java Beginners
java loops - Java Beginners
java loops - Java Beginners
JAVA LOOPS - Java Beginners
Write a program that (algorithmically) shows a times table.(convert integers to strings, format text, nested loops)
Write a program that (algorithmically) shows a times table.(convert integers to strings, format text, nested loops)   Write a java program..., nested loops) 0 1 2 3 4 5 6 7 8 9 0 0 0 0 0 0 0
print 100 numbers using loops

Ads