0% found this document useful (0 votes)
1 views4 pages

Outputs

Dhhdhdhdhdhdhjdd

Uploaded by

grmpp9m4h9
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views4 pages

Outputs

Dhhdhdhdhdhdhjdd

Uploaded by

grmpp9m4h9
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

public class Q1_1 {

public static void main(String[] args) {

String word = "tea";

String result ="";

int i = word.length() - 1;

while(i >= 0){

result += word.charAt(i);

i--;

System.out.println(result);

} }

public class Q1_2 {

public static void main(String[] args) {

int x=4;

while (x != 0) {

if (x % 3 == 0 && x != 9/3)

System.out.println(x++);

else

System.out.println(x--);

} }

public class Q1_3 {


public static void main(String[] args) {

int x = 10;

int y = 4;

int result = x / y + y * x - (x >= 11 ? 3 : y);

System.out.println(result);

} }

public class Q1_4 {

public static void main(String[] args) {

int number = 2;

int bonus = 1;

int totalGrade = 70;

switch (number) {

case 1:

bonus += 1;

case 2:

if (bonus > 0) {

bonus++;

break;

case 3:

bonus += 3;

case 4:

bonus = 4;

break;

default:

bonus = 0;

System.out.println(totalGrade +bonus);

} }
public class Q1_1 {
public static void main(String[] args) {
String word = "tea";
String result ="";
int i = word.length() - 1;
while(i >= 0){ aet
result += word.charAt(i);
i--;
}
System.out.println(result);
} }

public class Q1_2 {


public static void main(String[] args) {
int x=4;
while (x != 0) { 4
if (x % 3 == 0 && x != 9/3) 3
System.out.println(x++); 2
else 1
System.out.println(x--);
}
} }

public class Q1_3 {


38
public static void main(String[] args) {
int x = 10;
int y = 4;
int result = x / y + y * x - (x >= 11 ? 3 : y);
System.out.println(result);
} }

public class Q1_4 {


public static void main(String[] args) {
int number = 2;
int bonus = 1;
int totalGrade = 70;
switch (number) {
case 1:
bonus += 1;
case 2:
if (bonus > 0) {
bonus++;
break;
}
72
case 3:
bonus += 3;
case 4:
bonus = 4;
break;
default:
bonus = 0;
}
System.out.println(totalGrade
+bonus);
} }

You might also like