diff --git a/ch02/ex2_2.cpp b/ch02/ex2_2.cpp new file mode 100644 index 000000000..20092772e --- /dev/null +++ b/ch02/ex2_2.cpp @@ -0,0 +1,47 @@ +//AUTHOR YASH PARSANA +//DATE 11-05-2021 +//CALCULATOR To calculate a mortgage payment + +#include +using std::cin; +using std::cout; +using std::endl; + +float po(float r,int n) +{ + float ans=1; + + for(int z=1;z<=n;z++) + { + ans*=r; + } + return ans; +} +int main() +{ + float p_amount,rate; // FLOAT TAKES HALF SPACE AS COMPARE TO DOUBLE AND HERE HAVE NO REQUIREMENT OF DOUBLE + int year; + + cout<<"Please Enter principal Amount : "; + cin>>p_amount; + cout<>rate; + cout<>year; + cout<