#include<stdio.h>
#inculde<math.h>
int main ()
{
int R,n,A;
float S;
printf("plz give me the value of N elements:");
scanf("%d",&n);
printf("plz give me the value of the first term A:");
scanf("%d",&A);
printf("plz give me the ratio between 2 consecutive elements R:");
scanf("%d",&R);
S=(pow(R,n)-1)*A/(R-1);
printf("the value of the sum of a geometric series Sn=%f",S);
getchar(0);
return(0);
}
tarekkkkk
19
Light Poster
Recommended Answers
Jump to PostNot reading the error messages from your compiler?
A little more explanation of where you feel you are having a problem will help us to help you.
Val
All 4 Replies
vmanes
1,165
Posting Virtuoso
tracethepath
-2
Junior Poster in Training
tarekkkkk
19
Light Poster
tarekkkkk
19
Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.