the comment is Output is incorrect.
R$.15 Write a program that reads an initial investment balanceand an interest rate, then prints the number of years it takes forthe investment to reach one million dollars.
#include<iostream>using namespace std;int main(){ long int p,r,t=1; cout<<“Enter initial investment : “; cin>>p; cout<<“Enter Interest Rate : “; cin>>r; while((p+(p*r*t)/100)<1000000) {t++; } cout<<“Number of years : “<<t<<endl; return 0;}
Answer
#include<iostream>using namespace std;int main(){ long int p,r,t=1; cout<<“Enter initial investment : “; cin>>p; cout<<“Enter Interest Rate : “; cin>>r;
OR
OR