Question 16th: I have known the deposit as a, and the annual interest rate is x %. I tried to find out how many years after the deposit, the sum of the sum, and the sum of the sum doubled.

Source: Internet
Author: User

[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:

 
 


 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.