how i can solve this problem.....
generate the following staircase pattern(using loop operation)
1
2 4
3 6 9
4 8 12 16
5 10 15 20 25
6 12 18 24 30 36
7 14 21 28 35 42 49
Hi ronyyy,
DaniWeb has a golden rule that we only give homework help to those who have shown some effort first. Have you attempted the problem yet? If so, please post your code snippet and describe what problems you are having, otherwise what ideas have you come up with for your algorithm?
Here's something to think about to jumpstart your forming of an algorithm -- consider using nested loops. Have the outer loop keep track of the row and each time it completes have it jump to the next row, and have the inner loop print the contents of the row. Think about it and see where you get.
public class Nomames {
public static void main(String[] args) {
for(int i = 1 ; i < 100 ; i++){
for (int j = 1 ; j < i+1 ; j++){
System.out.print( i*j + " " );
}
System.out.println();
}
}
}
thanks endsamsara.....
...........ur program has worked for me with a little modification.......again...many many thanks....:-)
hii....darkagn..
..sory..i didn't know about the golden rule..........and yes...i tried to solve this program......but ..i don't know what is the problem....
public class Task2 {
public static void main(String[] args)
{
for (int row = 1; row <= 9; row++)
{
for (int column = row; column <2* row; column++)
System.out.print(column + " ");
System.out.println();
}
System.out.println();
System.out.println();
}
}
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.