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 ?    17 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

What is sizeof c?

0 Answers  


Write a program in c using only loops to print * * * * * *******

2 Answers   IBM,


What is const and volatile in c?

0 Answers  


what are the general concepts of c and c++

2 Answers  


a parameter passed between a calling program and a called program a) variable b) constant c) argument d) all of the above

0 Answers  






Given an array of characters which form a sentence of words, give an efficient algorithm to reverse the order of the words (not characters) in it?

3 Answers  


1.what are local and global variables? 2.what is the scope of static variables? 3.what is the difference between static and global variables? 4.what are volatile variables? 5.what is the use of 'auto' keyword? 6.how do we make a global variable accessible across files? Explain the extern keyword? 7.what is a function prototype? 8.what does keyword 'extern' mean in a function declaration?

2 Answers   nvidia,


What does 1f stand for?

0 Answers  


What is infinite loop?

0 Answers  


What will be printed as the result of the operation below: #include<..> int x; int modifyvalue() { return(x+=10); } int changevalue(int x) { return(x+=1); } void main() { int x=10; x++; changevalue(x); x++; modifyvalue(); printf("First output:%d\n",x); x++; changevalue(x); printf("Second output:%d\n",x); modifyvalue(); printf("Third output:%d\n",x); }

2 Answers  


What are the 5 types of organizational structures?

0 Answers  


what does static variable mean?

0 Answers   TCS,


Categories