429,101 Members | 1,340 Online
Need help? Post your question and get tips & solutions from a community of 429,101 IT Pros & Developers. It's quick & easy.

# to print different types of pyramids with numbers

 P: 1 like 1 10 101 1001 10001 1 10 101 1010 10101 Aug 26 '10 #1
4 Replies

 100+ P: 1,059 I always suggest the new programmer "If you want to make your computer to solve what you need, then first you figure it out- how you would solve it. Then implement it with the computer language." The thing is if you dont know how you would do this. there is no real help for you. Aug 26 '10 #2

 100+ P: 542 post some code to show how you would go about it. Aug 26 '10 #3

 100+ P: 542 hint: If s=0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1; s.length()prints 16 so s.length/2=8* If from the body of a for loop (with this end condition) you print a substr of s with a couple of simple arguments you may print a triangle of 0 and 1`s. Aug 30 '10 #4

 Expert 100+ P: 2,398 Is this the problem you're trying to solve: Write a program that outputs N lines of text, with the ith line (1<=i<=N) consisting of a "1" followed by N-i random digits, where the random digits are either "0" or "1". Aug 30 '10 #5