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

Why Modern OS are interrupt driven?Give an example

3 Answers  


What does *p++ do? What does it point to?

0 Answers  


What is volatile variable how do you declare it?

0 Answers  


If i have an array 0 to 99 i.e,(Size 100) I place the values 1 to 100 randomly like a[0]=29,a[1]=56 upto array[99].. the values are only between 1 to 100. getting the array values by using scanf.. If i entered one wrong element value line a[56]=108. how can i find it.. and also how to find the missing value in 1 to 100.. and i want to replace the missing values.. any one of them know please post your answer..

0 Answers   IBM, Wipro,


For what purpose null pointer used?

0 Answers  






Write a program that takes a 5 digit number and calculates 2 power that number and prints it.

1 Answers   Mind Tree,


character array A[12] can hold

5 Answers   Wipro,


write a program structure to find average of given number

1 Answers  


Can a variable be both constant and volatile?

0 Answers  


the 'sizeof' operator reported a larger size than the calculated size for a structure type. What could be the reason?

0 Answers  


a sequence of bytes with one to one corrspondence to those in the external device a) sequential addressing b) address c) byte code d) none

0 Answers  


What is the difference between %d and %*d in C

3 Answers  


Categories