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


Please Help Members By Posting Answers For Below Questions

Outline the major features of java.

561


What does s mean in regex?

549


How to calculate the length of a singly linked list in java?

581


What is java used for on a computer?

505


Why do we create public static method in java?

575






Have you ever used hashtable and dictionary?

568


What are different access specifiers in java? Explain

621


What is getclass () getname () in java?

673


Is null a value?

554


What is the preferred size of a component in java programming?

535


What is the default access specifier for variables and methods of a class?

562


What are the java ide's? Explain

521


Why does java have two ways to create child threads?

464


What is the difference between Java and C++?

610


How many decimal places is a double?

531