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

Answers were Sorted based on User's Feedback



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

Answer / guest

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 ?    16 Yes 3 No

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

Answer / venkat

#include<stdio.h>
void main()
{
int i,j,k=4,n=4;
for(i=0;i<n;i++)
{
for(j=1;j<=n-i;j++)
{
printf("%d",j);
}
printf(" ");
for(j=0;j<n-i;j++)
{
printf("%d",k-j);
//k--;
}
--k;
printf("
");
}

}

Is This Answer Correct ?    7 Yes 2 No

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

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

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

Answer / vamsi talapatra

#include<iostream>
using namespace std;
int main(){
int n = 4;
while(n>0){
for(int i = 1; i<=n; i++){
cout<<i;
}
cout<<" ";
for(int i = n; i>0; i--){
cout<<i;
}
n--;
cout<<endl;
}
return 0;
}

Is This Answer Correct ?    0 Yes 0 No

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

Answer / sunitha

for(i=1;i<=5;i++)
{
for(j=1;j<=i;i++)
{
for(k=1;k<=j;k++)

printf("%d",k);
k--;
printf("%d",k);

}
}

Is This Answer Correct ?    1 Yes 3 No

Post New Answer

More C Interview Questions

Differentiate between full, complete & perfect binary trees.

0 Answers  


Write a program that his output 1 12 123

0 Answers  


Explain what are bus errors, memory faults, and core dumps?

0 Answers  


atoi, which takes a string and converts it to an integer. write a program that reads lines(using getline), converts each line to an integer using atoi and computes the average of all the numbers read. also compute the standard deviation

0 Answers  


What is sparse file?

1 Answers  






Calculate 1*2*3*____*n using recursive function??

0 Answers  


What is function definition in c?

0 Answers  


design and implement a program that reads floating-points numbers in a sentinel-controlled loop until the user terminates the program by entering zero.your program should determinate and print the smallest,largest and average of the supplied numbers.

2 Answers  


Concat two string with most overlapped substring has to removeĀ  "abcd"+ "cdef" = "abcdef

6 Answers  


How can you increase the allowable number of simultaneously open files?

0 Answers  


which will return integer? a) int*s ( ) b) ( int* ) s( ) c) int ( *s ) ( )

1 Answers   C DAC,


Explain 'bus error'?

0 Answers  


Categories