12344321
123 321
12 21
1 1 how i print this program??
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
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 |
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 |
Differentiate between full, complete & perfect binary trees.
Write a program that his output 1 12 123
Explain what are bus errors, memory faults, and core dumps?
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
What is sparse file?
Calculate 1*2*3*____*n using recursive function??
What is function definition in c?
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.
Concat two string with most overlapped substring has to removeĀ "abcd"+ "cdef" = "abcdef
How can you increase the allowable number of simultaneously open files?
which will return integer? a) int*s ( ) b) ( int* ) s( ) c) int ( *s ) ( )
Explain 'bus error'?