/*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
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
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.
ReplyDeleteRegards,
Aamala
SEO Training in Chennai
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.
ReplyDeleteSAP ABAP Training in Chennai
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.
ReplyDeleteDigital Marketing services in Chennai
Ha ha ha. Superb and really nice to see these type of programs. And please keep update like this.
ReplyDeleteDigital Marketing For Small Business in Chennai
Great explanation to given on this post .The given information very impressed for me really so nice content.
ReplyDeleteBest Java J2ee training institutes in chennai
very useful information provided in this blog. concepts were explained in a detailed manner. Keep giving these types of information
ReplyDeleteSEO Training in Chennai
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.
ReplyDeleteweb design company in chennai
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.
ReplyDeleteBest Implant Clinic In Chennai