Sunday 6 July 2014

52)write a program to find out the amount after n periods,given the principle and the rate of interest.

#include <iostream>
#include<cmath>
using namespace std;
class fixeddeposit
{
  private:
  float p;
  int n;
  float r;
  float A;
  public:
  void setdata();
  void getamount();
};
void fixeddeposit::setdata()
 {
  cout<<"enter the value of p,n,and r"<<endl;
  cin>>p>>n>>r;
 }
 void fixeddeposit::getamount()
 {
  A=p*pow((1+r),n);
  cout<<"amount is  "<<A;
 }
 int main()
 {
  fixeddeposit b;
  b.setdata();
  b.getamount();
 }

No comments:

Post a Comment

Write a program which reads a set of integers into an integer array and then prints "YES"if all of them are same otherwise print "NO".

#include<stdio.h> int main() { int a[10],M=0,i,n; printf("enter a value for n\n"); scanf("%d",&n); fo...