This is intented for learning purposes, feel free to study the code
Create a drawing that looks like this (pyramid)
The number should be incremented with the modulus.
Then you should not posted at all because if they never learn basic they will fail. It is OK to help with attempt when someone tried and got catch in some circumstances that may not be obvious. However provide solution beforehand is plain bad.
WARNING: To anyone copying code for a homework assignments:
Your teacher can probably spot solutions copied from the web. If so you will get 0 marks, and may be penalised for cheating. YOu are also wasting your own time by cheating instead of learning. Write your own code!
Szabi: I'm sure your intentions were good, but in this forum we always perfer to teach people how to write good code. Your code may be a valid solution to the requirement, but in terms of commenting and clarity it's not a good example for a beginner, and not easy to learn from. Posts that just give solutions without explanations tend to pick up a lot of down-votes.
snippets is fine, but entire solutions to common homework problems is not.
For example the following is helpful to a lot of people in real situations, but useless to a schoolkid trying to get away with not doing his homework:
String requestUri = request.getRequestURI(); StringBuffer requestURL = request.getRequestURL(); requestURL.delete(requestURL.length()-requestUri.length(), requestURL.length()+1); requestURL.append(request.getContextPath());
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.