English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

8 answers

#include

main()
{
float P,A,r,n;

Printf("Enter Amount : ");
scanf("%f",&A);
Printf("\nEnter Rate : ");
scanf("%r",&r);
Printf("\nEnter Time : ");
scanf("%f",&t);
P = A * pow(1+r,n);
printf(" \nValue of P = ",P);
}

2006-09-14 03:22:18 · answer #1 · answered by nitin p 1 · 1 0

First include math.h

then using your logic write the equation in C syntax as:

P = A * pow(1+r, n);

pow is a power function it means the same that you want.

I hope you are satisfied.

2006-09-14 03:33:37 · answer #2 · answered by A D I T Y A 2 · 0 0

first include math.h file then use the following statement in the program

p=a*(pow((1+r),n))

2006-09-14 12:20:14 · answer #3 · answered by ASHOK PON KUMAR S 2 · 0 0

This may help you & reduce the size of your code

int Pow(int r, int n)
{
int temp;
int i;
int x = temp = r;
for(i = 1; i < n; i++)
{
temp = temp * x;
}
return temp;
}
call it this way from your main function
p = A * Pow((1+r), n);

2006-09-16 05:26:48 · answer #4 · answered by saurabh b 2 · 0 0

P = A * pow(1+r, n);

Where 'pow' is in math.h

2006-09-14 03:07:48 · answer #5 · answered by Dr.Mr.Ed 5 · 0 0

copy and paste the following code in your editor and compile it.
P=A*pow((1+r),n).

2006-09-14 03:13:41 · answer #6 · answered by Anonymous · 0 0

the answer is 4

2006-09-14 02:53:29 · answer #7 · answered by Anonymous · 0 0

#include
#include
void main()
{
int p,r,n,a,i;
clrscr();
printf("Input the value of r: ");
scanf("%d",&r);
printf("\n\nInput the value of n: ");
scanf("%d",&n);
printf("\n\nInput the value of A: ");
scanf("%d",&a);
p=1;
for(i=1;i<=n;i++)
p=p*(1+r);
p=p*a;
printf("\n\nA(1+r)^n=P=%d",p);
getch();
}

2006-09-14 08:24:29 · answer #8 · answered by ? 2 · 0 0

fedest.com, questions and answers