tag:blogger.com,1999:blog-5531960551406702359.post7340261647097839150..comments2024-03-29T12:14:02.680+05:30Comments on C Programming | Computer | Ms-Excel: Number Pyramid/TriangleDinesh Berahttp://www.blogger.com/profile/17779626530091691900noreply@blogger.comBlogger1125tag:blogger.com,1999:blog-5531960551406702359.post-5668856246975252912013-06-21T12:41:52.165+05:302013-06-21T12:41:52.165+05:30hi dude how about this problem
Q.ifference Triang...hi dude how about this problem<br /><br />Q.ifference Triangle<br />Introduction<br />Similar to Pascal’s triangle, the difference triangle has some interesting properties that find applications in various fields of the natural and applied sciences. In simple terms, a difference triangle is a set of integers arranged in an inverted triangle where each inverted triangle triad has its lower element equal to the difference (absolute value) of the two elements in the upper row.<br />A difference triangle can be created from a sequence of integers forming the uppermost row by iteratively taking differences between consecutive terms to form the next row until a single-element row is created.<br />Example<br />Consider the sequence 5, 8, 13, 21, 34, 55 from the Fibonacci series as the uppermost row of the difference triangle. The difference between successive elements form a new set: 3 (= 8 – 5), 5 (= 13 – 8), 8 (= 21 – 13), 13 (= 34 – 21), and 21 (= 55 – 34). The process can then be repeated until there is only one element left giving the following difference triangle:<br />5 8 13 21 34 55<br />3 5 8 13 21<br />2 3 5 8<br />1 2 3<br />1 1<br />0<br />Problem<br />Write a program that forms a difference triangle using a given series of numbers as topmost row.<br />Input<br />The input shall be a single line containing a sequence of positive integers separated by spaces. There shall be a maximum of 10 numbers, each less than 100000.<br />Output<br />The program shall output the difference triangle formed using the input series as topmost row, properly formatted (see sample runs).<br />Input ValidationAnonymoushttps://www.blogger.com/profile/01921985852274825735noreply@blogger.com