how can i make a program with this kind of output..
Enter a number: 5
0
01
012
0123
01234
012345
01234
0123
012
01
0
Answer Posted / salvin
A much more simpler implementation....
public class Test
{
public static void main(String[] args)
{
int no=5;
for(int n=0;n<=no;n++){
for(int m=0;m<=n;m++){
System.out.print(m);
}
System.out.println();
}
for(int n=no;n>=0;n--){
for(int m=0;m<n;m++){
System.out.print(m);
}
System.out.println();
}
}
}
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
write a c program to find the largest and 2nd largest numbers from the given n numbers without using arrays
What is an arrays?
What is the difference between class and object in c?
Explain how do you override a defined macro?
Explain high-order and low-order bytes.
what are the advanced features of functions a) function declaration and prototypes b) calling functions by value or by reference c) recursion d) all the above
What does the characters “r” and “w” mean when writing programs that will make use of files?
Write a program to maintain student’s record. Record should
not be available to any unauthorized user. There are three
(3) categories of users. Each user has its own type. It
depends upon user’s type that which kind of operations user
can perform. Their types and options are mentioned below:
1. Admin
(Search Record [by Reg. No or Name], View All Records,
Insert New Record, Modify Existing Record)
2. Super Admin
(Search Record [by Reg. No or Name], View All Records,
Insert New Record, Modify Existing Record, Delete Single Record)
3. Guest
(Search Record [by Reg. No or Name], View All Records)
When first time program runs, it asks to create accounts.
Each user type has only 1 account (which means that there
can be maximum 3 accounts). In account creation, following
options are required:
Login Name: <6-10 alphabets long, should be unique>
Password: <6-10 alphabets long, should not display
characters when user type>
Confirm Password:
Whats s or c mean?
how many key words availabel in c a) 28 b) 31 c) 32
Can we change the value of #define in c?
Explain how do you print an address?
When a c file is executed there are many files that are automatically opened what are they files?
What are header files in c?
Explain a pre-processor and its advantages.