Numbers pyramid
Hi sir,
Can you please tell me how to output this using nested for loops?
1
2, 1
1, 2, 3
4, 3, 2, 1
1, 2, 3, 4, 5
6, 5, 4, 3, 2, 1
1, 2, 3, 4, 5, 6, 7
8, 7, 6, 5, 4, 3, 2, 1
1, 2, 3, 4, 5, 6, 7, 8, 9
10, 9, 8, 7, 6, 5, 4, 3, 2, 1
View Answers
September 7, 2012 at 6:43 AM
Sorry the correct way i need is,
1
(Start a new line)2, 1
(Start a new line)1, 2, 3
(Start a new line)4, 3, 2, 1
(Start a new line)1, 2, 3, 4, 5
(Start a new line)6, 5, 4, 3, 2, 1
(Start a new line)1, 2, 3, 4, 5, 6, 7
(Start a new line)8, 7, 6, 5, 4, 3, 2, 1
(Start a new line)1, 2, 3, 4, 5, 6, 7, 8, 9
(Start a new line)10, 9, 8, 7, 6, 5, 4, 3, 2, 1
Ads
Related Tutorials/Questions & Answers:
Numbers pyramid
Numbers pyramid Hi sir,
Can you please tell me how to output this using nested for loops?
1
2, 1
1, 2, 3
4, 3, 2, 1
1, 2, 3, 4, 5
6, 5, 4, 3, 2, 1
1, 2, 3, 4, 5, 6, 7
8, 7, 6, 5, 4, 3, 2, 1
1, 2, 3, 4, 5, 6, 7, 8, 9
10, 9, 8
Advertisements
Java Pyramid of Numbers
Java
Pyramid of Numbers Hi, I want to know how the code to print the
pyramid below works. It uses nested for loops.
Pyramid:
1
2 1 2
pyramid
pyramid hi frnds i need java code for
pyramid.
the
pyramid look like this
A
BAB
CBABC
BAB
pyramid
pyramid hi i need java code for
pyramid.
the
pyramid look like this.
A
BAB
CBABC
BAB
pyramid
pyramid how to get the output like this
A
BB
CCC
DDDD
Hi Friend,
Try the following code:
class
Pyramid
{
public static void main(String[] args)
{
for(char ch1='A';ch1<='D';ch1
pyramid
pyramid How to get the code for the following pattern
*
* *
* * *
* * * *
class
Pyramid{
public static void main(String args[]){
for(int i=1;i<=4;i
pyramid
pyramid How to get the code for the following pattern
*
* *
* * *
* * * *
class
Pyramid{
public static void main(String args[]){
for(int i=1;i<=4;i
pyramid
pyramid how to print
1
22
333
4444
55555
class
Pyramid
{
public static void main(String[] args)
{
for(int i=1;i<=5;i++){
for(int j=1;j<=i;j++){
System.out.print(i
sorting numbers
sorting numbers How to sort the
numbers in ascending order
import java.util.*;
class SortNumbers{
public static void main(String...=input.nextInt();
list.add(num);
}
System.out.println("
Numbers
print numbers in traingle shape
print
numbers in traingle shape 1
22
333
4444
i want output like this please help me
class
Pyramid
{
public static void main(String[] args)
{
for(int i=1;i<=4;i++){
for(int j=1;j<
Prime Numbers
Prime Numbers Create a complete Java program that allows the user to enter a positive integer n, and which then creates and populates an int array with the first n prime
numbers. Your program should then display the contents
Rational Numbers
Rational Numbers Write and fully test a class that represents rational
numbers. A rational number can be represented as the ratio of two integer values, a and b, where b is not zero. The class has attributes for the numerator
Listing all even numbers between two numbers
Listing all even
numbers between two numbers Hi,
How to write code to list all the even
numbers between two given
numbers?
Thanks
Hi,
You function will take 2
numbers and the find the even
numbers between
Hexadecimal numbers multiplication
Hexadecimal
numbers multiplication Sir,
I have to multiply 128 bit hexadecimal
numbers. Do u have any logic for this??
The
numbers are like
ab7564fa342b5412c34d9e67ab341b58
ModuleNotFoundError: No module named 'numbers'
ModuleNotFoundError: No module named '
numbers' Hi,
My Python... '
numbers'
How to remove the ModuleNotFoundError: No module named '
numbers... to install padas library.
You can install
numbers python with following command
Adding two numbers
Adding two numbers Accepting value ffrom the keyboard and adding two
numbers
odd numbers with loop
odd
numbers with loop get the odd
numbers till 100 with for,while loop
Java find odd
numbers:
class OddNumbers
{
public static void main(String[] args)
{
for(int i=1;i<=100;i
Sum of positive and negative numbers
; import java.util.*;
class
Numbers
{
public static void main(String...=0,sum2=0;
int num[]=new int[10];
System.out.println("Enter 10
numbers...];
}
}
System.out.println("Sum of positive
numbers: "+sum2);
System.out.println
Sum of first n numbers
Sum of first n numbers i want a simple java program which will show the sum of first
n
numbers....
import java.util.*;
public class...;
}
System.out.println("Sum of
Numbers from 1 to "+n+" : "+sum
number pyramid
;class
Pyramid{
public static void main(String args[]){
for(int i=1;i<=7...; class
Pyramid{
public static void main(String args[]){
for(int i
Divide 2 numbers
Divide 2 numbers Write a java program to divide 2
numbers. Avoid division by zeor by catching the exception.
class Divide
{
public static void main(String[] args)
{
try{
int num1=8
finding the prime numbers
finding the prime numbers Hi, I am a beginner to java and I have problem with the code in finding the prime
numbers, can someone tell me about the problem.
Thanks.
Want to know about how to find out the given
Formatting numbers in Velocity Templates?
Formatting
numbers in Velocity Templates? I need to display amount in following formats:
1099 -> 1,099.00
100 -> 100.00
100.251 -> 100.25
10999 -> 10,999.00
1110999 -> 11,10,999.00
Right now I am using
Formatting numbers in Velocity Templates?
Formatting
numbers in Velocity Templates? I need to display amount in following formats:
1099 -> 1,099.00
100 -> 100.00
100.251 -> 100.25
10999 -> 10,999.00
1110999 -> 11,10,999.00
Right now I am using