## IN ***JAVA***- Lucky Number A four-digit number `ABCD` is called lucky if `A` + `B` = `C` + `D` Write a program th

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

## IN ***JAVA***- Lucky Number A four-digit number `ABCD` is called lucky if `A` + `B` = `C` + `D` Write a program th

Post by answerhappygod »

## IN ***JAVA***- Lucky Number

A four-digit number `ABCD` is called lucky if `A` + `B` = `C` + `D`

Write a program that asks the user to enter a four-digit number and tell if the number is a lucky
number or not. if it's a lucky number print `Yay, <number> is a lucky number`, otherwise
print `Nah, <number> is not a lucky number`

**Example 1:**

```text
Please enter 4 digits number:
>3719
Yay, 3719 is a lucky number
```

**Example 2:**

```text
Please enter 4 digits number:
>3521
Nah, 3521 is not a lucky number
```
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply