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 |
Why Modern OS are interrupt driven?Give an example
What does *p++ do? What does it point to?
What is volatile variable how do you declare it?
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..
For what purpose null pointer used?
Write a program that takes a 5 digit number and calculates 2 power that number and prints it.
character array A[12] can hold
write a program structure to find average of given number
Can a variable be both constant and volatile?
the 'sizeof' operator reported a larger size than the calculated size for a structure type. What could be the reason?
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
What is the difference between %d and %*d in C