Number Guessing Game Java Project for Beginners | Java Projects with Source Code | IntelliSkills

  Рет қаралды 163

IntelliSkills

IntelliSkills

Күн бұрын

Пікірлер: 5
@rajeshpasupuleti9250
@rajeshpasupuleti9250 2 ай бұрын
For specific number iterations can we use for loop right
@IntelliSkills
@IntelliSkills 2 ай бұрын
Yes.
@rajeshpasupuleti9250
@rajeshpasupuleti9250 2 ай бұрын
package java_exm; import java.util.Scanner; public class GuessNumberPuzzle { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc=new Scanner(System.in); int random=(int) (Math.random()*100); System.out.print("guess number: "); int guess=sc.nextInt(); boolean flag=true; int i=1; while(flag&&irandom) { System.out.println("it is less than your guess number"); guess=sc.nextInt(); } else { System.out.println("it is greater than your guess number"); guess=sc.nextInt(); } i++; } System.out.println("its over"); } } correct me if iam wrong
@IntelliSkills
@IntelliSkills 2 ай бұрын
the code was really nice and it was somewhat correct. There was only one mistake I could find, i.e., it was six guesses, not 5. You see, at first only you are taking one guess. So, in the while loop instead of writing i
@rajeshpasupuleti9250
@rajeshpasupuleti9250 2 ай бұрын
​@@IntelliSkillsmam tell me the exact difference between for and while loop. And how tricky question asked in an interview
Develop a NUMBER GUESSING GAME using flag-controlled while loop in Java
11:53
Мен атып көрмегенмін ! | Qalam | 5 серия
25:41
To Brawl AND BEYOND!
00:51
Brawl Stars
Рет қаралды 17 МЛН
Generate random numbers in Python 🎲
8:03
Bro Code
Рет қаралды 74 М.
Coding Was HARD Until I Learned These 5 Things...
8:34
Elsa Scola
Рет қаралды 806 М.
Array vs. ArrayList in Java Tutorial - What's The Difference?
17:36
Coding with John
Рет қаралды 566 М.
Arrays In Java Tutorial #10
9:26
Alex Lee
Рет қаралды 471 М.
Simon Sinek's Advice Will Leave You SPEECHLESS 2.0 (MUST WATCH)
20:43
Alpha Leaders
Рет қаралды 829 М.
Python laid waste to my C++!
17:18
Sheafification of G
Рет қаралды 144 М.
How I Would Learn Python FAST in 2024 (if I could start over)
12:19
Thu Vu data analytics
Рет қаралды 628 М.
Java Int Variables #7
5:10
Alex Lee
Рет қаралды 125 М.
Мен атып көрмегенмін ! | Qalam | 5 серия
25:41