Logo 
Search:

C Programming Articles

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

Program for investment problem using while loop

Posted By: Beatriz Silva     Category: C Programming     Views: 3559

Write a Program for investment problem using while loop.

Code for Program for investment problem using while loop in C Programming

/*--------------------- INVESTMENT PROBLEM --------------------*/
#define PERIOD 10 #define PRINCIPAL 5000.00 /*-------------------- MAIN PROGRAM BEGINS --------------------*/
main() { /*------------------- DECLARATION STATEMENTS ----------------*/
int year; float amount, value, inrate; /*------------------- ASSIGNMENT STATEMENTS -------------------*/
amount = PRINCIPAL; inrate = 0.11; year = 0; /*------------------ COMPUTATION STATEMENTS -------------------*/
/*--------------- COMPUTATION USING While LOOP ----------------*/
while(year <= PERIOD) { printf(“%2d %8.2f\n”,year, amount); value = amount + inrate * amount; year = year + 1; amount = value; } /*----------------------- while LOOP ENDS ---------------------*/
} /*------------------------ PROGRAM ENDS -----------------------*/
  
Share: 


Didn't find what you were looking for? Find more on Program for investment problem using while loop Or get search suggestion and latest updates.

Beatriz Silva
Beatriz Silva author of Program for investment problem using while loop is from Salvador, Brazil.
 
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!