954,505 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

plz help i dont know what am i doing wrong

#include
#inculde
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
Light Poster
35 posts since Nov 2007
Reputation Points: 29
Solved Threads: 0
 

Not 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

vmanes
Posting Virtuoso
1,914 posts since Aug 2007
Reputation Points: 1,268
Solved Threads: 228
 

can you tell the input for which the output is coming wrong?
because when i tried N as 4, A as 1 and R as 2...
output came correct...

and in second line include has wrong spellings...it must be giving errors when compiled...
and one more thing please wrap code in code tags...

tracethepath
Junior Poster in Training
54 posts since Jul 2007
Reputation Points: 8
Solved Threads: 4
 

in this line it seems the error S=(pow(R,n)-1)*A/(R-1);

tarekkkkk
Light Poster
35 posts since Nov 2007
Reputation Points: 29
Solved Threads: 0
 

allright it worked but the page is disappearing i dont know why and i am righting getchar(0)

tarekkkkk
Light Poster
35 posts since Nov 2007
Reputation Points: 29
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You