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.

Answers were Sorted based on User's Feedback



Scenario: There are 1 to 100 numbers. Each number should be keep in the each column like from A co..

Answer / ashwin khandelwal

public class NumPlacing {

int k=0;
int n=4;
int val=0;
int[]a=new int[101];

public void done(){

for(int j=0;j<n;j++){

if(val<101){

for(int i=0;i<26;i++){

val=val+1;
int count=i+1;
a[val]=val;
k++;
System.out.println(count+"->"+a[val]+"\t");

}
System.out.println("\n");

}
}

}
public static void main(String args[]){
NumPlacing num=new NumPlacing();
num.done();
}

}

Is This Answer Correct ?    8 Yes 2 No

Scenario: There are 1 to 100 numbers. Each number should be keep in the each column like from A co..

Answer / 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

Scenario: There are 1 to 100 numbers. Each number should be keep in the each column like from A co..

Answer / rupesh

package com.ab.Demo;

public class demo
{
public static void main(String[] args)
{
for (int i=1;i<=100;i++ )
{
if (i%26==0)
{
System.out.print(i+"\t");
System.out.println("");
}
else
{
System.out.print(i+"\t");
}

}

}
}

Is This Answer Correct ?    0 Yes 0 No

Scenario: There are 1 to 100 numbers. Each number should be keep in the each column like from A co..

Answer / badrinath

int var=0,n=100/26;
for(int j=0;j<=n;j++){
for(int i=0;i<26;i++)
{ var=var+1;
if(var>100)
break;
System.out.print(var+"/");

}
System.out.println(); }

}

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

What is the mapping mechanism used by java to identify IDL language?

0 Answers  


describe synchronization in respect to multithreading? : Java thread

0 Answers  


What is sortedmap in java?

0 Answers  


What is parseint?

0 Answers  


Explain the use of sublass in a java program?

0 Answers  






I need some details about an employee. i have only the employee id in my presentation layer(JSP).I entered that ID and click "Show Details" Button. Question is how the JSP pass that id to Controller layer and DAO and what mechanism we are using to retrive data from DB and how the data passed to JSP as a Output. Please explain in detail.

1 Answers   TCS,


Can you explain the difference b/n abtract and interface with a good example,?In what cases we have use abtract and what case interface?

4 Answers   Satyam,


my method "abc" return array of interface "xyz" and "pqr" is abstract class implements abc and class "jkl" extends pqr My problem 1) when i call abc it retrun array xyz how can i do this hint xyz refer_xyz = new jkl(); but i can't create array. 2)I want to access method of jkl using reference of xyz??

1 Answers  


What is meant by main method?

0 Answers  


There are three interfaces A,B & C. A extends B, B extends C, and C extends A.Is it multiple Inheritance? please anybody help me.....

5 Answers  


What is difference between fileinputstream and filereader in java?

0 Answers  


What is a finally block?

0 Answers  


Categories