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 is numeric function?
What is the purpose of static keyword in java?
What is the purpose of stub and skeleton?
Why does java have different data types for integers and floating-point values?
Which is a valid identifier?
Why is inheritance used in java?
Difference between doublesummarystatistics, intsummarystatistics and longsummarystatistics ?
What is the difference between yielding and sleeping?
What is the difference between iterator and list iterator?
How do you escape sequences in java?
What is the advantage of functional interface in java 8?
How many ways can we create the string object?
Explain illegalmonitorstateexception and when it will be thrown?
What do you mean by platform independence of Java?
How finally used under exception handling?