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 ? | 17 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 |
What is diffrance between declaration and defination of a variable or function
main() { int x=20,y=35; x = y++ + x++; y = ++y + ++x; printf("%d %d\n",x,y); }
27 Answers Advent Global Solutions, CitiGroup, Valeo Lighting Systems India Private Limited, Vishal Transformers, Wipro, Zencer,
what is pointer ? what is the use of pointer?
how we can make 3d venturing graphics on outer interface
How can I find the day of the week given the date?
What is the best way of making my program efficient?
Difference between Shallow copy and Deep copy?
in one file global variable int i; is declared as static. In another file it is extern int i=100; Is this valid ?
Explain what is the advantage of a random access file?
i want explaination about the program and its stack reprasetaion fibbo(int n) { if(n==1 or n==0) return n; else return fibbo(n-1)+fibbo(n-2); } main() { fibbo(6); }
FORMATTED INPUT/OUTPUT functions are a) scanf() and printf() b) gets() and puts() c) getchar() and putchar() d) all the above
How can I get Single byte from 'int' type variable? Can we alter single bit or multiple bits in int type variable? if so, How?