Comment Output Incorrect R 15 Write Program Reads Initial Investment Balance Interest Rate Q37179273

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

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.