0% found this document useful (0 votes)
11 views

Java Practice

Uploaded by

Abhi
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Java Practice

Uploaded by

Abhi
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

import java.util.

Scanner;
public class Main
{
public static void main (String[]args)
{
/* System.out.println ("quiz1");
System.out.println ("write the following equation in java ");
//first equation
int x = 10;
int y =50
int a = x - y;
int b = 2;
int c = a / 2;
//second equation
int d = (b * b - 4 * a * c) / 2 * a;
//third equation;
int e = a * b - d;
System.out.println ("quiz2");
int a = 10;
a++;
++a;
--a;
System.out.println (a);
System.out.println ("quize 3");
// question 1
int y = 7;
int x = ++y * 8;
System.out.println (x);
// question 2
char a = 'c';
a++;
System.out.println (a);
Scanner sc = new Scanner (System.in);
int a = sc.nextInt ();
if (a >= 18 && a <= 100)
{
System.out.println ("thnks");
}
else
{
System.out.println ("sorry you are not able join");
}

System.out.println ("please enter your age");


Scanner st = new Scanner (System.in);
int p = st.nextInt ();
if (p < 18)
{
System.out.println ("your unable to use this ");
}
else if (p == 18)
{
System.
out.println ("sorry this is is adult content try next year!!!");
}
else if (p < 18 && p >= 21)
{
System.out.print ("your able to acceess some type content ");
}
else if (p >= 21 && p <= 100)
{
System.out.println ("all access");
}
else
{
System.out.println ("something went wrong please check your details");
}

}
}
*/

You might also like