Scenario: There are 1 to 100 numbers. Each number should be
keep in the each column like from A column to Z column ie 1
to 26. From 27 to 52 should be in 2nd row in the excel
sheet. This has to be continue till 100. How do you write
Java program and what are various methods.
Answer Posted / vishal
public class NumberPlacing {
int k=0;
int n=4;
int val=0;
int[]a=new int[101];
public void printInTabularForm(){
int noOfRows = 100/26;
int rowStart = 1;
int setEnd = 26;
for(int i=rowStart; i<=setEnd; i++){
System.out.print(i+"\t");
if(i == 100){
break;
}else if(i==setEnd){
rowStart = i;
setEnd = i+26;
System.out.println();
}
}
}
public static void main(String args[]){
NumberPlacing num=new NumberPlacing();
num.printInTabularForm();
}
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What does || mean in vectors?
What is variable and rules of variable?
Why to use nested classes in java?
what is mena by object block any what is the use of that
Should you use singleton pattern?
Explain different ways of creating a thread. Which one would you prefer and why?
Difference between == and .equals() ?
How will you serialize a singleton class without violating singleton pattern?
What are the 6 boolean operators?
What is a treeset in java?
Why java is platform independent? Explain.
what are Hostile Applets?
Can the interface be final?
Considering notepad/ie or any other thing as process, what will happen if you start notepad or ie 3 times? Where 3 processes are started or 3 threads are started?
Can we override tostring method in java?