AD (728x90)

GoogleOnline Exam Test Seminar Sparkz IncEasy Link Exchange

Saturday 31 May 2014

Write a C program to read in two numbers, x and n, and then compute the sum of this geometric progression: 1+x+x2+x3+????

Seminars and Jobs information
Share it Please
/*Write a C program to read in two numbers, x and n, and then compute the sum of this geometric progression:
1+x+x2+x3+????.+xn For example: if n is 3 and x is 5, then the program computes 1+5+25+125.
Print x, n, the sum Perform error checking. For example, the formula does not make sense
for negative exponents - if n is less than 0. Have your program print an error message if n<0, 
then go back and read in the next pair of numbers of without computing the sum.
Are any values of x also illegal ? If so, test for them too. */

#include<stdio.h>
#include<conio.h>
#include<math.h>

void main()
{
int s_sum,i,x,n;

clrscr();
printf("Enter the values for x and n:");
scanf("%d %d",&x,&n);
For more Click

Written by

Java Basic Point blog is created for the MCA,M.Tech,B.Tech and Graduate students.So visit and get the benifits from this blog.

8 comments:

  1. Everything is fine, am happy about your blog. Thanks admin for sharing the unique content, you have done a great job I appreciate your effort and I hope you will get more positive comments from the web users.

    Regards,
    Aamala

    SEO Training in Chennai

    ReplyDelete
  2. Your blog is really great. I really enjoyed by reading your post. This give me more information about the programming. I gained more knowledge by seeing your post. Thanks for sharing this informative blog with us.
    SAP ABAP Training in Chennai

    ReplyDelete
  3. your software usage report is really awesome and it is very much interesting i like the features and it is very well to get about the clear concept.


    Digital Marketing services in Chennai

    ReplyDelete
  4. Ha ha ha. Superb and really nice to see these type of programs. And please keep update like this.

    Digital Marketing For Small Business in Chennai

    ReplyDelete
  5. Great explanation to given on this post .The given information very impressed for me really so nice content.
    Best Java J2ee training institutes in chennai

    ReplyDelete
  6. very useful information provided in this blog. concepts were explained in a detailed manner. Keep giving these types of information
    SEO Training in Chennai

    ReplyDelete
  7. Such a great article. I got a many tips on your post. I think it’s useful to me and others. And a keep on update more blogs like this.Thank you very much.

    web design company in chennai

    ReplyDelete
  8. Thanks for appreciating. Really means and inspires a lot to hear from you guys.I have bookmarked it and I am looking forward to reading new articles. Keep up the good work..Believe me, This is very helpful for me.

    Best Implant Clinic In Chennai


    ReplyDelete

© 2013 Learning Java. All rights resevered. Designed by Templateism