Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void Main(string[]args)
- {
- double sumofir, sumdanny;
- sumofir = SumIntrest(1000, 6, 36);//מחשב את הכסף שהיה לאופיר אחרי 3 שנים עם 6 אחוזי ריבית
- sumofir = SumIntrest(8147.25, 7, 36);//מחשב את הכסף שהיה לאופיר אחרי עוד 3 שנים עם 7 אחוזי ריבית
- Console.WriteLine("the money that Ofir had after 6 years is: " + sumofir + " Shekels");
- sumdanny = MonthlyIntrest(100,5);//מחשב את הכסף שהיה לדני אחרי 3 שנים עם ריבית של 5 אחוזים והוספה של 100 בכל חודש
- for (int i = 0; i < 35; i++)
- {
- sumdanny += 100;
- sumdanny = SumIntrest(sumdanny, 5, 1);
- }
- Console.WriteLine("after 3 years danny had " + sumdanny + " Shekels");
- }
- static double MonthlyIntrest(double money, int intrest)//מחשב ריבית בחודש כשנתון הכסף והאחוזי ריבית
- {
- double afterintrest;
- afterintrest = money + (0.01 *intrest * money);
- return afterintrest;
- }
- static double SumIntrest(double money, int intrest, int months)//מחשב את הריבית בכמה חודשים כשנתון הכסף אחוזי הריבית ומספר החודשים
- {
- double lastintrest;
- lastintrest = MonthlyIntrest(money, intrest);
- for (int i = 1; i < months; i++)
- {
- lastintrest = MonthlyIntrest(lastintrest, intrest);
- }
- return lastintrest;
- }
Advertisement
Add Comment
Please, Sign In to add comment