In: Computer Science
This code assigns the maximum of the values 3 and 5 to the int variable max and outputs the result
int max;
// your code goes here
This code prompts the user for a single character and prints "true" if the character is a letter and "false" if it is not a letter
// your code goes here
mport java.util.*;
public class Letter
{
public static void main(String args[])
{
Scanner sc = new
Scanner(System.in);
int max;
int var1 = 3;
int var2 = 5;
if(var1 > var2)
{
max =
var1;
}
else
{
max =
var2;
}
System.out.println("maximum number
is : "+max);
System.out.println("enter a
character:");
char ch =
sc.next().charAt(0);
if(ch >=65 && ch<=90
|| ch >= 97 && ch <= 122)
{
System.out.println("true\n");
}
else
{
System.out.println("flase\n");
}
}
}
If you have any doubts please comment and please don't dislike