A computer science problem by Nazmus sakib

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
#include<stdio.h>
include <math.h>

main ()
{

 float p, r, n, i, f
printf("Please enter a value for the principal (P) : ");
scanf("%f", &p);
printf("Please enter a value for the interest rate (r) : );
scanf("%f", &r);
prinf("Please enter a value for the number of years (n) : " );
scanf("%f", &n)
i=r/100;
f=p*pow(1+i),n);
printf("\nThe final value (F) is: %.2f\n"  f);
}

How many errors does the following program contain?


The answer is 7.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

Typical Beam
Sep 12, 2018

Line 2 : # before include

Line 4 : no type declaration for main (such as void)

Line 7 : no semicolon after declaration of the float variables

Line 10 : semicolon not closed

Line 12 : "prinf" instead of printf

Line 13 : no semicolon

Line 15 : improper brackets

Where is return?

Md Zuhair - 2 years, 3 months ago

1 pending report

Vote up reports you agree with

×

Problem Loading...

Note Loading...

Set Loading...