🔒 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");
}
 
Status
Not open for further replies.

About this Thread

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

Trending Topics

Online now

Members online
1,239
Guests online
19,397
Total visitors
20,636

Forum statistics

Threads
2,289,400
Posts
29,058,287
Members
1,213,739
Latest member
markarvin
Back
Top