[Link].
print("*\n**\n***\n****\n*****\n");
---
*
**
***
****
*****
int a=22;
int b=10;
int diff=a+b;
[Link](diff);
---
32
priority of operators is from left to write
* / % these are more priority than < > + and evry thing
import [Link].*;
Scanner bc = new Scanner([Link]);
String name= [Link]();
[Link](name);
// input from user
Scanner sc = new Scanner([Link]);
int a= [Link]();
int b= [Link]();
int sum= a*b;
[Link](sum);
//conditional statement
import [Link].*;
class firstclass {
public static void main(String args[]) {
Scanner sc =new Scanner([Link]);
int a = [Link]();
int b = [Link]();
if (a==b) {
[Link]("both are equal");
}
else {
if (a>b) {
[Link]("a is greater");
}
else {
[Link]("b is greter");
}
}
}
}
//using else if
if (a==b) {
[Link]("both are equal");
}
else if (a>b) {
[Link]("a is greter");
}
else {
[Link]("b is greater");
}
// example of conditional statement
import [Link];
class firstclass {
public static void main(String args[]) {
Scanner sc=new Scanner([Link]);
int button=[Link]();
if (button==1) {
[Link]("HELLO");
}
else if (button==2) {
[Link]("NAMASTE");
}
else if (button==3) {
[Link]("BOUNJOUR");
}
else {
[Link]("INVALID BUTTON");
}
}
}
// switch use
import [Link];
class firstclass {
public static void main(String args[]) {
Scanner sc=new Scanner([Link]);
int button=[Link]();
switch (button) {
case 1 : {
[Link]("HELLO");
}break;
case 2 : {
[Link]("NAMASTE");
} break;
case 3 : {
[Link]("BONJOUR");
} break;
default : {
[Link]("invalid button");
}
}
}
}
// calculator
import [Link].*;
class calculatorclass {
public static void main(String args[]) {
Scanner sc= new Scanner([Link]);
[Link]("enter the first number ");
int a =[Link]();
[Link]("enter the second number ");
int b= [Link]();
[Link]("choose an operation");
[Link]("1: Sum\n2: Difference\n3: Multiplication\n4: Division\n5:
Remender");
int operation=[Link]();
int sum= a+b;
int diff=a-b;
int mul=a*b;
int div=a/b;
int rem=a%b;
switch (operation) {
case 1 : {
[Link](sum);
} break;
case 2 : {
[Link](diff);
} break;
case 3 : {
[Link](mul);
} break;
case 4 : {
[Link](div);
} break;
case 5 : {
[Link](rem);
}
default : {
[Link]("invalid input operation : READ THE COMMANDS
PROPERLY");
}
}
}
//loop
import [Link].*;
class calculatorclass {
public static void main(String args[]) {
for(int j=1; j<=11; j++) {
[Link](j);
}
int i=1;
while(i<=11) {
[Link](i);
i++;
}
}
// do while
int i=1;
do {
[Link](i);
i++;
} while (i<=10);
// even number between n numbers
import [Link].*;
class calacutta {
public static void main (String args[]) {
Scanner sc = new Scanner([Link]);
int n = [Link]();
for (int i=1; i<=n; i++) {
if (i%2==0){
[Link]("even numbers are" + i);
}
}