Fundamentals of Computer Programming - Old Questions

3. Find the error in the given program and explain it. Write the correct program.

#include<stdio.h>

include<math.h>

main

{

float p, r, n;

printf(“Please enter a value for the principle (P):”);

scanf(“%f”, &p);

printf(“Please enter a value for the interest rate (R)”);

scanf(“%f”, &r);

printf(“Please enter a value for the number of years (n):”):

scanf(“%f”, n);

f = p * pow + r/100),n);

printf(\\n The final value (F) is: %. 2f\\n”, f);

6 marks | Asked in 2066