Pattern

public class Main
{
public static void main(String[] args)
{
String s="COMPUTER";
int l=s.length();
int k=l-1;
for(int i=0;i<l;i++)
{

for(int j=k;j<l;j++)
{
System.out.print(s.charAt(j));

}
System.out.println();k=k-1;
}
}
}
R
ER
TER
UTER
PUTER
MPUTER
OMPUTER
COMPUTER

Second largest number in java using ternary operator

 //Largest second number using ternary operator public class Main { public static void main(String[] args) { int a=5,b=6,c=7; int ...