Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- int i,min,max,sum=0, ratio;
- printf("Enter the minimum value: ");
- scanf("%d", &min);
- printf("Enter the maximum value : " );
- scanf("%d", &max);
- printf("Enter the common ratio :");
- scanf("%d", &ratio);
- for (i=min ; i<=max ; i*=ratio){
- printf("%d\n", i);
- sum=sum+i ;
- }
- printf("the sum of the geometric series is: %d\n", sum);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement