import java.util.*;
import java.lang.*;
import java.io.*;
// The main method must be in a class named "Main".
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Hello i am your AI");
System.out.println("tell me your name ");
String name = sc.next();
System.out.println("i think a no. b/w [ 1 to 5 ] guess it ok");
String againstart = "";
// do while loop use krne k liye pehle ek khali string bnanana pdta h
//❤️❤️
do{ System.out.println("Do you want to play ");
String yesno= sc.next();
if (yesno.equals("yes"))
// this is imp in string if write this type
{
// 1st guess
System.out.println("Okk"+name+" lets guess which number am i thinking");
int first = sc.nextInt();
if (first==2)
{
System.out.println("Ohh! (◉‿◉) congratulations! You guessed it right! ");
System.exit(0);
}
else
{
System.out.println("I'm sorry,Keep trying ");
System.out.println("the number I'm thinking is 2");
System.out.println("okk! lets again guess a number ");
}
//2nd guess
int second = sc.nextInt();
if (second==5)
{
System.out.println("Ohh! (◉‿◉) congratulations! You guessed it right! ");
System.exit(0);
}
else
{
System.out.println("Your guess of "+second+" is incorrect.The number I'm thinking is 5");
System.out.println("oops! again guess what am i thinking");
}
//guess third
int third = sc.nextInt();
if (third==4)
{
System.out.println("Ohh! (◉‿◉) congratulations! You guessed it right! ");
System.exit(0);
}
else
{
System.out.println("Your guess of "+third+" is incorrect.The number I'm thinking is 4");
System.out.println("its third time guess wrong lets play again");
}
//guess 4
int fourth = sc.nextInt();
if (fourth==3)
{
System.out.println("Ohh! (◉‿◉) congratulations! You guessed it right! ");
System.exit(0);
}
else
{
System.out.println("Your guess of "+fourth+" is incorrect.The number I'm thinking is 3");
System.out.println("you are very fool person lets play again ");
}
//guees 5
int fifth = sc.nextInt();
if (fifth==1)
{
System.out.println("Ohh! (◉‿◉) congratulations! You guessed it right! ");
System.exit(0);
}
else
{
System.out.println("Your guess of "+fifth+" is incorrect.The number I'm thinking is 1");
System.out.println("bhai tu rhne de ab");
System.exit(0);
}
}// first if brac
else if (yesno.equals("no"))
System.out.println("oops! (ಠ_ಠ)"+name+" you are not playing with me °Bye°");
else
{ System.out.println("please say yes or no only");
againstart = sc.next();
}
} while (againstart.equalsIgnoreCase("yes"));
// do while brac ❤️❤️
}
}
To embed this program on your website, copy the following code and paste it into your website's HTML: