Write a program to input a number N (0<N<27).
Display the letter corresponding to the number (if N is 1, display A)
import java.util.*;
class Char4
{
char ch;
int N;
void take()
{
for(;; )
{
System.out.print(“\nEnter the number (1-26):”);
N=sc.nextInt();
If(N>0 && N<27)
break;
}
System.out.print((char)(N+64));
}
public static void main(String args[])
{
Char4 ob=new Char4();
ob.take ();
}
}
No comments:
Post a Comment