Monday, 13 December 2010

Flow chart for To read in two numbers x and n and then compute the sum of this geometric progression 1+x+x2+x3+……….+xn

In this program we have to read the two numbers and the calculate the sum of this geometric progression in above mention .





Output:

1.Enter the values for x and n:2 3
Value is valid Sum of series=15

2.Enter the values for x and n:4 9
Value is valid Sum of series=21845
  3.Enter the values for x and n:01
 Value is not valid

Conclusion: the program is error free

VIVA QUESTIONS:

1) what is the difference between structures and unions ?
Ans: Here the major difference is with in the structure all elements must be allocated memory. But in union highest memory allocation must be allocated to all these elements.



c programs

No comments:

Post a Comment