Why my program not give proper output for Final Amount? (SOLVED) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why my program not give proper output for Final Amount? (SOLVED)

Write a program to create a structure called BankDeposit(). Structure members are amt (amount to deposit in bank), tenure (No. of years the deposit to be maintained). Create another structure called Date(), structure members are int date, int month, int year. Enter DOB of person, Date of deposit using Date structure variables. Calculate present age of the person. If the person is senior citizen (age >=60 yrs) then rate of interest is 9%, else 8%. Calculate the total amount that person receives after date of maturity (=date of deposit+ tenure). Structure BankDeposit () { Int amt; Int tenure; }; Structure Dates () { Int date; Int month; Int year; }; Input1: Amt=1000 rs. Tenure=2 years DOB= 01/01/1960 Output1: Age= 61 years Interest=9%=0.09 Final amount=amt+(amt*interest*tenure) =1180 rs. Input2: Amt=1000 rs. Tenure=2 years DOB= 01/01/2000 Output2: Age= 21 years Interest=8%=0.08 Final amount=1160 rs.

29th Jun 2021, 5:50 PM
Karthik
3 Answers
+ 4
Integers can only store whole numbers. Whenever you want to store fractions such as 0.09, you need to use either float or double as the datatype.
29th Jun 2021, 6:20 PM
Shadow
Shadow - avatar
29th Jun 2021, 5:51 PM
Karthik
0
Shadow Oh Yeah Thank you I got It.
29th Jun 2021, 6:27 PM
Karthik