Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Homework HelpRSS Feeds

INTERACTIVE INVESTMENT PROGRAM

Posted By: Sophie Brown     Category: C Programming     Views: 3206

INTERACTIVE INVESTMENT PROGRAM.

Code for INTERACTIVE INVESTMENT PROGRAM in C Programming

  main()                                                       
  {                                                            
      int    year, period ;                                    
      float  amount, inrate, value ;                           
                                                               
      printf("Input amount, interest rate, and period\n\n") ;  
      scanf ("%f %f %d", &amount, &inrate, &period) ;          
      printf("\n") ;                                           
      year = 1 ;                                               
                                                               
      while( year <= period )                                  
      {                                                        
            value = amount + inrate * amount ;                 
            printf("%2d  Rs %8.2f\n", year, value) ;           
            amount = value ;                                   
            year = year + 1 ;                                  
      }                                                        
  }                                                            
                                                              
 
Output                                                       
                                                              
  Input amount, interest rate, and period                      
                                                               
  10000  0.14  5                                               
                                                               
   1  Rs 11400.00                                              
   2  Rs 12996.00                                              
   3  Rs 14815.44                                              
   4  Rs 16889.60                                              
   5  Rs 19254.15                                              
                                                               
  Input amount, interest rate, and period                      
                                                               
  20000  0.12  7                                               
                                                               
   1  Rs 22400.00                                              
   2  Rs 25088.00                                              
   3  Rs 28098.56                                              
   4  Rs 31470.39                                              
   5  Rs 35246.84                                              
   6  Rs 39476.46                                              
   7  Rs 44213.63                                              
  
Share: 


Didn't find what you were looking for? Find more on INTERACTIVE INVESTMENT PROGRAM Or get search suggestion and latest updates.

Sophie Brown
Sophie Brown author of INTERACTIVE INVESTMENT PROGRAM is from London, United Kingdom.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!