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 sizeof c?
Write a program in c using only loops to print * * * * * *******
What is const and volatile in c?
what are the general concepts of c and c++
a parameter passed between a calling program and a called program a) variable b) constant c) argument d) all of the above
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?
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?
What does 1f stand for?
What is infinite loop?
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); }
What are the 5 types of organizational structures?
what does static variable mean?