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
How can you find the day of the week given the date?
Write a code to achieve inter processor communication (mutual exclusion implementation pseudo code)?
What is 1f in c?
How do we print only part of a string in c?
In cryptography, you could often break the algorithm if you know what was the original (plain) text that was encoded into the current ciphertext. This is called the plain text attack. In this simple problem, we illustrate the plain text attack on a simple substitution cipher encryption, where you know each letter has been substituted with a different letter from the alphabet but you don’t know what that letter is. You are given the cipherText as the input string to the function getwordSets(). You know that a plain text "AMMUNITION" occurs somewhere in this cipher text. Now, you have to find out which sets of characters corresponds to the encrypted form of the "AMMUNITION". You can assume that the encryption follows simple substitution only. [Hint: You could use the pattern in the "AMMUNITION" like MM occurring twice together to identify this]
How to throw some light on the b tree?
How can I implement a delay, or time a users response, with sub-second resolution?
What is a sequential access file?
plz let me know how to become a telecom protocol tester. thank you.
What is the use of define in c?
What the different types of arrays in c?
how to make a scientific calculater ?
if p is a string contained in a string?
What are the three constants used in c?
Differentiate between null and void pointers.