🔒 Closed NEED HELP BASIC JAVA

Status
Not open for further replies.
Write a program that will ask the user to enter his/her initial name and then output a greeting that says "Hello", followed by the user's initial name.
Example:
Please enter your initials: B G
Hello B G!

Write a program that will ask the user to enter two numbers and then compare if the numbers entered are equal or not. Display a message informing the user if the numbers are equal or not.
Example:
Please enter the first number: 2
Please enter the second number: 3
2 and 3 are not equal.

Need help po mga sir. Pero pwede rin po youtube tutorial na cover tong gantong task.
 
string name;
string answer;
Scanner scan = new Scanner(System.in);
System.out.print("Please enter your initials: ");
answer = scan.nextLine();
System.out.println("Hello" + answer);
 
int num1,num2;
Scanner scan = new Scanner(System.in);
System.out.print("Please enter the first number: ");
num1 = scan.nextInt();
System.out.print("Please enter the second number: ");
num2 = scan.nextInt();
if (num1 == num2) {
System.out.println(num1 + " and " + num2 + " are equal");
}
else if{
System.out.println(num1 + " and " + num2 + " are not equal");
}
 
1604220323069.webp
 
Status
Not open for further replies.

About this Thread

  • 8
    Replies
  • 511
    Views
  • 2
    Participants
Last reply from:
Heywazup

Online now

Members online
989
Guests online
734
Total visitors
1,723

Forum statistics

Threads
2,275,614
Posts
28,964,460
Members
1,231,883
Latest member
daemondevera
Back
Top