+ 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.]

9th Feb 2018, 3:27 PM
Swapnil Srivastava
Swapnil Srivastava - avatar
9 Answers
9th Feb 2018, 8:24 PM
Louis
Louis - avatar
+ 20
I added a sample pattern which will draw using 6n² asterisks and a hint.
10th Feb 2018, 5:58 AM
Swapnil Srivastava
Swapnil Srivastava - avatar
+ 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
9th Feb 2018, 7:00 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 16
x can be any natural number.
9th Feb 2018, 4:18 PM
Swapnil Srivastava
Swapnil Srivastava - avatar
+ 7
what is x ???? whether it is user input or randomize value ......
9th Feb 2018, 4:36 PM
VISHAL SRIVASTAVA
VISHAL SRIVASTAVA - avatar
+ 4
is x defined or some random number?
9th Feb 2018, 4:15 PM
‎ ‏‏‎Anonymous Guy
9th Feb 2018, 7:21 PM
Arun
+ 3
let's give it a try..
9th Feb 2018, 7:06 PM
Arun
- 2
In the sample code I gave input as 500 and it crashed after giving an array of asterix finally stated “time limit exceeded
12th Feb 2018, 3:15 AM
Diwakar Jain
Diwakar Jain - avatar