+ 33
[ASSIGNMENT] 🏆 Special Pattern 🏆
Challenge #7 Let's create patterns with asterisks. The challenge is to take a number n as input and draw a pattern with xn² asterisks where x is another natural number. Also display the number of asterisks printed. A simple pattern will be squares or triangles. But, be more creative. Create more interesting shapes. All languages accepted. Good luck. EDIT: Sample code : https://code.sololearn.com/c0yQFX70r4Ul/?ref=app [HINT: sum of consecutive odd nos starting from 1 is always a perfect square.]
9 Answers
+ 20
I added a sample pattern which will draw using 6n² asterisks and a hint.
+ 17
x can be any natural no... smaller than 10 for a good output
/*draw circle,parabola,hyperbola,st. lines , many more
here also xn^2 , u can use in forming many eqn's ☺*/
https://code.sololearn.com/cw3XyJM8Tfqi/?ref=app
+ 16
x can be any natural number.
+ 7
what is x ????
whether it is user input or randomize value ......
+ 4
is x defined or some random number?
+ 4
https://code.sololearn.com/cn2U6bnkEM2i/?ref=app
enter a number
+ 3
let's give it a try..
- 2
In the sample code I gave input as 500 and it crashed after giving an array of asterix finally stated “time limit exceeded