समस्या
एक विशेष ऋण राशि (ब्याज के साथ) के लिए हर महीने के बाद भुगतान की जाने वाली शेष किस्त की गणना करने के लिए एक सी प्रोग्राम लिखें।
समाधान
ऋण राशि दिए जाने पर ब्याज की गणना करने का सूत्र निम्नलिखित है -
i=loanamt * ((interest/100)/12);
निम्नलिखित गणना ब्याज के साथ राशि देती है -
i=i+loanamt; firstmon=i-monthlypayment; //first month payment with interest i=firstmon * ((interest/100)/12);
कार्यक्रम
#include<stdio.h> int main(){ float loanamt,interest,monthlypayment; float i,firstmon,secondmon; printf("enter the loan amount:"); scanf("%f",&loanamt); printf("interest rate:"); scanf("%f",&interest); printf("monthly payment:"); scanf("%f",&monthlypayment); //interest calculation// i=loanamt * ((interest/100)/12); //amount with interest i=i+loanamt; firstmon=i-monthlypayment; //first month payment with interest i=firstmon * ((interest/100)/12); i=i+firstmon; secondmon=i-monthlypayment; //second month payment with interest printf("remaining amount need to pay after 1st installment:%.2f\n",firstmon); printf("remaining amount need to pay after 2nd installment:%.2f\n",secondmon); return 0; }
आउटपुट
enter the loan amount:45000 interest rate:7 monthly payment:1000 remaining amount need to pay after 1st installment:44262.50 remaining amount need to pay after 2nd installment:43520.70