Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I\'m trying to create a program which calculates the remaining area until the ar

ID: 3542561 • Letter: I

Question

I'm trying to create a program which calculates the remaining area until the area becomes less and or equal to 10^-6 time the original one but my program is not working. What am i doing wrong?


int main() {

   int n(0);

          int Aoriginal=1;

double A ;

    

  

    

    

    //Print heading

    cout << " n A, square centimeters " ;

   

while (A <= 0.000001   )

{

   A = Aoriginal * pow (0.75, n);

cout << n <<  " "  <<  setprecision(6) << A << endl;

n +=1;

}


system("pause");

return 0;

}  // closing brace

Explanation / Answer

#include<iostream>

#include<math.h>

#include<iomanip>

using namespace std;


int main() {

int n(0);

int Aoriginal=1;

double A=1.0 ;

//Print heading

cout << " n A, square centimeters " ;

while (A > 0.000001 )

{

A = Aoriginal * pow (0.75, n);

cout << n << " " << setprecision(6) << A << endl;

n +=1;

}


system("pause");

return 0;

}