[Plain]
[Plain]
/* Start the comments in the program header (to avoid any problems encountered during the submission of blog posts, the slash used to indicate that the comments have been deleted)
* Copyright and version Declaration of the program
* All rights reserved.
* File name: txt. c
* Author: liuyongshui
* Question: if the deposit is a and the annual interest rate is x %, try to find out how many years after the deposit, the current, profit, and double.
(Note: If s is used to represent the sum of profits, the cycle must express "When (s <2 * a), increase by 1 year, calculate the sum of cost and profit at the end of the next year ")
* Problem source:
* Completion date: January 1, April 22, 2013
* Version No.: V1.0
*/
# Include <stdio. h>
Void star (void); // print the asterisk
Int main ()
{
Int I;
Float money; // The money that begins to be saved.
Float begin_money ;//
Float late_money = 0.0 ;//
Float rate = 0.035;
Star (); // print the asterisk
Printf ("\ t Welcome to Happy bank \ n ");
Printf ("Our bank's interest rate is % 0.3f. \ n", rate );
Printf ("Enter the money you want to save :");
Scanf ("% f", & money );
Begin_money = late_money = money;
For (I = 1; late_money <2 * money; I ++)
{
Late_money + = begin_money * rate;
Begin_money = late_money;
Printf ("after % 2d, you will have % 0.3f RMB. \ N ", I, late_money );
}
Printf ("\ n % d years later, you have % 0.3f yuan, at this time, Ben, and doubled \ n", I-1, late_money );
Printf ("\ n Haha, thank you for your cooperation! \ NGOOD BYE! \ N ");
Star (); // print the asterisk
Return 0;
}
// Star Function
Void star (void)
{
Int I;
For (I = 0; I <60; I ++)
{
Printf ("*");
}
Printf ("\ n ");
}
/* Start the comments in the program header (to avoid any problems encountered during the submission of blog posts, the slash used to indicate that the comments have been deleted)
* Copyright and version Declaration of the program
* All rights reserved.
* File name: txt. c
* Author: liuyongshui
* Question: if the deposit is a and the annual interest rate is x %, try to find out how many years after the deposit, the current, profit, and double.
(Note: If s is used to represent the sum of profits, the cycle must express "When (s <2 * a), increase by 1 year, calculate the sum of cost and profit at the end of the next year ")
* Problem Source: http://blog.csdn.net/sxhelijian/article/details/7304484
* Completion date: January 1, April 22, 2013
* Version No.: V1.0
*/
# Include <stdio. h>
Void star (void); // print the asterisk
Int main ()
{
Int I;
Float money; // The money that begins to be saved.
Float begin_money ;//
Float late_money = 0.0 ;//
Float rate = 0.035;
Star (); // print the asterisk
Printf ("\ t Welcome to Happy bank \ n ");
Printf ("Our bank's interest rate is % 0.3f. \ n", rate );
Printf ("Enter the money you want to save :");
Scanf ("% f", & money );
Begin_money = late_money = money;
For (I = 1; late_money <2 * money; I ++)
{
Late_money + = begin_money * rate;
Begin_money = late_money;
Printf ("after % 2d, you will have % 0.3f RMB. \ N ", I, late_money );
}
Printf ("\ n % d years later, you have % 0.3f yuan, at this time, Ben, and doubled \ n", I-1, late_money );
Printf ("\ n Haha, thank you for your cooperation! \ NGOOD BYE! \ N ");
Star (); // print the asterisk
Return 0;
}
// Star Function
Void star (void)
{
Int I;
For (I = 0; I <60; I ++)
{
Printf ("*");
}
Printf ("\ n ");
}
For example: