Got Homework?
Connect with other students for help. It's a free community.
Here's the question you clicked on:
 0 viewing
shaik0124
Group Title
can anyone write a program to print
1
11
121
1331
14641
 one year ago
 one year ago
shaik0124 Group Title
can anyone write a program to print 1 11 121 1331 14641
 one year ago
 one year ago

This Question is Closed

infinity_ Group TitleBest ResponseYou've already chosen the best response.3
you mean pascal's triangle
 one year ago

infinity_ Group TitleBest ResponseYou've already chosen the best response.3
what you 've written above is a part of pascal's triangle
 one year ago

shaik0124 Group TitleBest ResponseYou've already chosen the best response.0
kk whatever it is just write a code to print that 1
 one year ago

infinity_ Group TitleBest ResponseYou've already chosen the best response.3
could you give me full description of the assignment? A program that prints "that 1" coud be printf("1\n"); printf("11\n"); etc. if you want pascal's triangle it's a lot different (obviously)
 one year ago

shaik0124 Group TitleBest ResponseYou've already chosen the best response.0
kk if u think it is pascal thn write a code using for loop
 one year ago

infinity_ Group TitleBest ResponseYou've already chosen the best response.3
i don't think you understand.I am willing to help you as much as i can and show you how to write it but i will not write it for you.Do you want to tell me your ideas on the problem?
 one year ago

shaik0124 Group TitleBest ResponseYou've already chosen the best response.0
yaar i just need a c code which will output as above i have mentioned
 one year ago

infinity_ Group TitleBest ResponseYou've already chosen the best response.3
Before the code, there is the algorithmic concept.Without the algorithmic concept you cannot write code, not know, not ever. When someone gives you a problem you have to say: Do i understand the problem? If not i read it again What data structure should I use? What type of problem is it? How can i create an algorithm that solves the problem? and then you code. You still didn't tell me how are you planning to solve this one.
 one year ago

shaik0124 Group TitleBest ResponseYou've already chosen the best response.0
see i am trying to solve this problem by using for loops
 one year ago

shaik0124 Group TitleBest ResponseYou've already chosen the best response.0
i will give an example now
 one year ago

shaik0124 Group TitleBest ResponseYou've already chosen the best response.0
#include<stdio.h> #include<conio.h> main() { int i,j,k=1,l; for(i=1;i<=4;i++) { for(j=3;j>=i;j) { printf(" "); } for(l=1;l<=i;l++) { printf("%d ",k); k++; } printf("\n"); } getch(); }
 one year ago

shaik0124 Group TitleBest ResponseYou've already chosen the best response.0
this code will print 1 23 456 78910
 one year ago

infinity_ Group TitleBest ResponseYou've already chosen the best response.3
i see.And this is why i told you the above.Do you know what pascal's triangle is?
 one year ago

shaik0124 Group TitleBest ResponseYou've already chosen the best response.0
now just writea code to print the question i have asked
 one year ago

infinity_ Group TitleBest ResponseYou've already chosen the best response.3
Is this a command? What if i give you the code? what will you get out of it? nothing.You have to understand the problem before going around on the internet demanding to solve it for you.I will tell you that pascal's triangle is a triangle with many applications as it is used in binomial theorem.Each node of the triangle is constructed by adding the numbers which are above it.For example The first number is 1 in the next row the first number is 1 and the second is one too.In the third row the first number is 1 the second number is 1+1=2 and the third is 1.In the fourth the first one is 1 the second one 3 the third one 3 and the fourth one 1 again.So this way a triangle is constructed 1 1 1 1 2 1 1 3 3 1 As you might understand this can go on up to row N. Your problem wants you to create an algorithm which calculates pascal triangle up to row i. Any ideas how you can do that?
 one year ago

shaik0124 Group TitleBest ResponseYou've already chosen the best response.0
bcoz of not having idea i asked u
 one year ago

infinity_ Group TitleBest ResponseYou've already chosen the best response.3
ok.What is important is that you now understand the problem.Since everything is clear i can proceed by explaining the solution to you :)
 one year ago

shaik0124 Group TitleBest ResponseYou've already chosen the best response.0
kk explain
 one year ago

infinity_ Group TitleBest ResponseYou've already chosen the best response.3
The main concept is that you construct a 2D array of N rows and N columns.initially array[0][0]=1 and array[1][0]=array[1][1]=1 This is the base of our induction.Now for every row i>1 every array[i][0]=array[i][i]=1.For every column j>1 we have array[i][j]=array[i1][j]+array[i1][j1] which means that we look on the row above and then we add the two neighbouring elements.That's how you can construct pascal's triangle.Try implementing the above idea to a language of your choice and if you get stuck i can help you (You 'd better write it in c or c++).
 one year ago

infinity_ Group TitleBest ResponseYou've already chosen the best response.3
Of course for every j, 1<j<i
 one year ago

infinity_ Group TitleBest ResponseYou've already chosen the best response.3
If you think you can't make it i can give you the code.Just make sure you'll study it.
 one year ago

shaik0124 Group TitleBest ResponseYou've already chosen the best response.0
kk give the code
 one year ago

infinity_ Group TitleBest ResponseYou've already chosen the best response.3
If you want my opinion though you have to practice on algorithmical problem solving and programming so that you reach a level that you can solve most of the problems you come across.It's a good idea to start solving problems here www.projecteuler.net and then proceed to more sophisticated stuff.Good luck ;)
 one year ago

shaik0124 Group TitleBest ResponseYou've already chosen the best response.0
#include<stdio.h> #include<string.h> #include<conio.h> int count=0; char arr1[20],arr2[20]; int main() { int j; arr1[0]=1; arr1[1]='\0'; int flag=3; for(j=3;j>=1;j) printf(" "); printf("1\n"); while(flag>=0) { for(j=3;j>=count;j) printf(" "); arr2[0]=arr1[0]; arr2[strlen(arr1)]=arr1[strlen(arr1)1]; for(j=1;j<=(strlen(arr1)1);j++) arr2[j]=arr1[j]+arr1[j1]; arr2[strlen(arr1)+1]='\0'; for(j=0;j<strlen(arr2);j++) printf("%d ",arr2[j]); for(j=0;j<=strlen(arr2);j++) arr1[j]=arr2[j]; flag; count++; printf("\n\n"); } getch(); }
 one year ago

shaik0124 Group TitleBest ResponseYou've already chosen the best response.0
here is the code which outputs the pattren for my question@infi
 one year ago

infinity_ Group TitleBest ResponseYou've already chosen the best response.3
good job.Now make it work for any number of rows provided by the user ;)
 one year ago

farmdawgnation Group TitleBest ResponseYou've already chosen the best response.2
@shaik0124 In the future, please do not ask our users to just give you the answer. This is expressly against the Code of Condcut: http://openstudy.com/codeofconduct Thanks.
 one year ago

online_careers Group TitleBest ResponseYou've already chosen the best response.0
Absolutely!
 one year ago

shaik0124 Group TitleBest ResponseYou've already chosen the best response.0
who r u to say @farma n y i shouldn't ask users to give answer if i dont know.....?
 one year ago

farmdawgnation Group TitleBest ResponseYou've already chosen the best response.2
The purpose of our site is for our users to teach you how to do the problems you don't understand, not to serve up the answer on a silver platter. As I mentioned, the Code of Conduct outlines that this site is for getting help, not answers. http://openstudy.com/codeofconduct
 one year ago

shaik0124 Group TitleBest ResponseYou've already chosen the best response.0
hey dont over act,getting help is kinda same thing as knowing answers....i dont think that everyone will get solution of the question asked when some1 teaches how to solve that problem...see many teachers teach the concept but still students willl not b able to solve problems based on that concept.....understand urself first nnnnn dont b too intelligent every1 wil not b as intelligent as u......btw who r u to say this?if u r owner u should know everything well n if u know well then y u creating a debate here let us move peacefully n finally i will delete my account from this i don want u n ur explanation ok happy happy@farmda
 one year ago

infinity_ Group TitleBest ResponseYou've already chosen the best response.3
@shaik0124 farmdawgnation is a moderator.Good morning..
 one year ago

shaik0124 Group TitleBest ResponseYou've already chosen the best response.0
i was about to delete my account from open study bcoz of offline of some users i am waiting once i complete my chat with them within few days i will delete@farmda
 one year ago

shaik0124 Group TitleBest ResponseYou've already chosen the best response.0
n who is this .....@online careers go out of here it between me n farmda u dont mingle here go n do ur work
 one year ago
See more questions >>>
Your question is ready. Sign up for free to start getting answers.
spraguer
(Moderator)
5
→ View Detailed Profile
is replying to Can someone tell me what button the professor is hitting...
23
 Teamwork 19 Teammate
 Problem Solving 19 Hero
 Engagement 19 Mad Hatter
 You have blocked this person.
 ✔ You're a fan Checking fan status...
Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.