0% found this document useful (0 votes)
14 views5 pages

06 Petabwtnwtb

wgbwtbyw

Uploaded by

Justineee
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views5 pages

06 Petabwtnwtb

wgbwtbyw

Uploaded by

Justineee
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Import java.util.

*;

Public class Main {

Public static void main(String[] args) {

Scanner scanner = new Scanner(System.in);

System.out.print(“Enter a number: “);

Int number = scanner.nextInt();

If (number > 0) {

System.out.println(“The number is positive.”);

} else if (number < 0) {

System.out.println(“The number is negative.”);

} else {

System.out.println(“The number is zero.”);

. OUTPUT:
import java.util.*;

Public class Main {

Public static void main(String[] args) {

Scanner scanner = new Scanner(System.in);

System.out.print(“Enter a number (1-12): “);

Int monthNumber = scanner.nextInt();

Switch (monthNumber) {

Case 1: System.out.println(“January”); break;

Case 2: System.out.println(“February”); break;

Case 3: System.out.println(“March”); break;

Case 4: System.out.println(“April”); break;

Case 5: System.out.println(“May”); break;

Case 6: System.out.println(“June”); break;

Case 7: System.out.println(“July”); break;

Case 8: System.out.println(“August”); break;

Case 9: System.out.println(“September”); break;

Case 10: System.out.println(“October”); break;

Case 11: System.out.println(“November”); break;

Case 12: System.out.println(“December”); break;

Default: System.out.println(“Invalid input, please enter a number


between 1 and 12.”);

}
OUTPUT:
Import java.util.*;

Public class Main {

Public static void main(String[] args) {

Scanner scanner = new Scanner(System.in);

Int product = 1;

Double sum = 0;

System.out.println(“Enter 5 numbers:”);

For (int I = 1; I <= 5; i++) {

System.out.print(“Enter number “ + I + “: “);

Int number = scanner.nextIn();

Product *= number;

Sum += number;

Double average = sum /5;

System.out.println(“Product of the numbers: “ + product);

System.out.println(“Average of the numbers: “ + average);

}
OUTPUT:

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy