12344321
123 321
12 21
1 1 how i print this program??

Answer Posted / harika

package basic_java_examples;

public class Numbers {

public static void main(String[] args){

int i,j,n=4;
for(i=0;i<=n;i++){
System.out.println();
for(j=1;j<=n-i;j++)
System.out.print(j);
for(j=0;j<2*i;j++)
System.out.print(" ");
for(j=n-i;j>=1;j--)
System.out.print(j);
}
}

}

Is This Answer Correct ?    4 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is getch?

616


What are different types of pointers?

550


Write a program to swap two numbers without using a temporary variable?

593


What are keywords in c with examples?

590


What is meant by 'bit masking'?

868






Can a function be forced to be inline? Also, give a comparison between inline function and the C macro?

641


What is variable and explain rules to declare variable in c?

541


What is difference between scanf and gets?

598


What is sorting in c plus plus?

556


Study the following C program :call_me (myvar)int myvar;{ myvar +- 5; }main(){int myvar;myvar = 3;call_me(myvar);printf("%d ",myvar);What will be printed a) 3 b) 5 c) 8 d) symbol

652


c language supports bitwise operations, why a) 'c' language is system oriented b) 'c' language is problem oriented c) 'c' language is middle level language d) all the above

600


What is an endless loop?

788


What is output redirection?

678


What are file streams?

552


What is typedef example?

603