Publicité
Write a SIMPLE java program to print out the numbers from 100 to 1- wi.docx
Write a SIMPLE java program to print out the numbers from 100 to 1- wi.docx
Prochain SlideShare
Write a simple c++ program that computes the value of ex by using the.docxWrite a simple c++ program that computes the value of ex by using the.docx
Chargement dans ... 3
1 sur 2
Publicité

Contenu connexe

Plus de drosa1(20)

Publicité

Write a SIMPLE java program to print out the numbers from 100 to 1- wi.docx

  1. Write a SIMPLE java program to print out the numbers from 100 to 1, with the following conditions: If the number ends in 4, don't print it; instead, print "hello" If the number is a multiple of 6, don't print it; instead print "world" If the number is both a multiple of 6 and ends in 4, don't print it, instead print "hello world" Solution import java.util.Scanner; class Helloworld { public static void main(String []args) { Scanner input = new Scanner(System.in); int num=100; System.out.println("Input your number and press enter: "); if(num== 4) { System.out.println("Hello"); } else if(num==6) { System.out.println("world"); } else { System.out.println("Hello world"); } } }
Publicité