Best Answer

long factorial(int); int main() { int i, n, c; printf("Enter the number of rows you wish to see in pascal triangle\n"); scanf("%d",&n); for ( i = 0 ; i < n ; i++ ) { for ( c = 0 ; c <= ( n - i - 2 ) ; c++ ) printf(" "); for( c = 0 ; c <= i ; c++ ) printf("%ld ",factorial(i)/(factorial(c)*factorial(i-c))); printf("\n"); } return 0; } long factorial(int n) { int c; long result = 1; for( c = 1 ; c <= n ; c++ ) result = result*c; return ( result ); }

User Avatar

Wiki User

โˆ™ 2013-02-21 12:13:10
This answer is:
User Avatar
Study guides
See all Study Guides
Create a Study Guide

Add your answer:

Earn +20 pts
Q: What is the logic and theory for pascal triangle program in C?
Write your answer...
Still have questions?
magnify glass
Related questions

What has the author Thomas Downs written?

Thomas Downs has written: 'Logic design with Pascal' -- subject(s): Logic circuits, Computer-aided design, Data processing, Pascal (Computer program language), Design and construction

What is the difference between a Theory and a Logic?

A theory is just a thought. Logic is when a theory has been put to the test and is proved to be correct.

What is logic circuit and switching theory?

what is logic circuits and switching theory? how can it help us in our daily needs

Need of program Logic controllers?

Program logic controllers are used to control the operation of most systems.

A sentence for logic?

Logic is a theory of reasoning. An example sentence would be: According to his logic, it was alright to lie.

What is the logic of in triangle in C-programming?

Your question is ambiguous.

Why is advisable to plan the logic of a program?

It is very much advisable to plan the logic of a program because it tells the program how to deliver information to a computer system.

What is the theory in math that uses the words IF and THEN?


What has the author Arthur D Friedman written?

Arthur D. Friedman has written: 'Fundamentals of logic design and switching theory' -- subject(s): Logic circuits, Logic design, Switching theory

What is the relationship between an algoritham and a program?

hello, The algorithm is the step by step process of explaining the program. The program is used for executing the logic. While the algorithm is used for the understanding of the logic

What is the importance of set theory in math?

It develops the power to apply logic and logic in an integral part of mathematics.

What has the author Georg Kreisel written?

Georg Kreisel has written: 'Elements of mathematical logic (Model theory)' -- subject(s): Symbolic and mathematical Logic 'Elements of mathematical logic' -- subject(s): Symbolic and mathematical Logic 'Modelltheorie' -- subject(s): Model theory

What is snarled program logic called?

spaghetti code

What is snarled program logic?

Snarled program logic is unstructured logic, also known as "spaghetti" logic. Compiled machine code is the ultimate example of snarled program logic. Although spaghetti code is more compact and efficient than structured code, it is extremely difficult to both comprehend and maintain. Hence we use structured programming languages to provide a high level of abstraction between the logic of the programmer and the snarled logic of the machine-dependant code.

What has the author John T Kearns written?

John T. Kearns has written: 'Reconceiving experience' -- subject(s): Experience, Knowledge, Theory of, Language and languages, Language and logic, Philosophy, Theory of Knowledge 'The principles of deductive logic' -- subject(s): Language and logic, Logic

What is the name of the branch of math that has to do with reasoning and proof?

Mathematical logic and proof theory (a branch of mathematical logic) for proof

How can you get logic studio for free?

Apple Logic Studio is a commercial program, so you will have to buy it, or get a job at Apple.

What is the difference between a semantic error and logic error?

An error in the logic of a program means that the output of the program is faulty (eg the program tell you 2+2=5). An error in semantics in a program means that the program statements are not constructed properly and the usual result of this is that the program will not compile.

What tools can you use to design program logic?

paper plaintext

What has the author Pascal Engel written?

Pascal Engel has written: 'Norme du vrai' -- subject(s): Logic, Logic, Symbolic and mathematical, Symbolic and mathematical Logic 'Philosophie et psychologie' 'Truth' -- subject(s): Truth 'Etats d'esprit' -- subject(s): Cognition, Mind and body, Spirit, Body, Human (Philosophy) 'La verite, reflexions sur quelques truismes'

How did Mayans use mathematics?

they created the theory and logic of the number of zero

What is the Difference between program and flowchart?

Flowchart it is diagrammatic Program it is coding. A flowchart is drawn out on paper, and shows the logic of an if/then/else statement. The programming actually is the if/then/else, not just the logic.

Why is it important to math study set theory?

It develops the power to apply logic and logic is an intigral part of mathematics. More over application of venn diagrams helps to get solutions of complicated questions easily. Set theory is a combination of art, logic and calculations.

Who invented Logic oriented graphic oriented program?

LOGO or (Logic oriented graphic oriented) was invented by Wally_Feurzeigand Seymour_Papert.

What are the advantages of turbo pascal?

it would help you logically.. and would simply introduce to you what is programming.. and about coding.. as having knowledge about this turbo pascal.. it is like studying first the logic needed in coding... ^^. Well, this question implies two things. First, the programming language Pascal is good because it is simple and easy to learn, compared to other languages e.g. C or Java. The code written in Pascal is also easy to read. There is less bugs (mistakes) when we write programs in Pascal, again compared to C. Second, the Turbo Pascal (software package) is a good environment for us to conveniently write Pascal programs. There are shortcut keys to compile and run the program. There are tools for debugging (correcting mistakes) in our code, too.