Program to calculation of Simple Interest in c language in hindi
Calculation of Simple Interest
हम c language में simple interest निकालने के program बनाने से पहले जानेगे कि आखिर simple interest है क्या | अगर आप नही जानते तो मैं आपको बता दू यह एक ब्याज है जो कि किसी धनराशि पर लगता है जिसे निकालने का फार्मूला निम्न है
S
i
m
p
l
e I
n
t
e
r
e
s
t
= (P
r
i
n
c
i
p
a
l
×
T
i
m
e
×
R
a
t
e)/100
सबसे पहले हम constant values लेकर के simple interest कैलकुलेट करेगे बाद में user के through कैलकुलेट करवायेगे
OUTPUT:
Simple interest is : 255.000
Code in C language:
/*Calculation of simple interest*/
#include<stdio.h>
#include<conio.h>
void main()
{
void main()
{
int p,n; //declare integer type variables
float r,si; //declare decimal type variable
p=1000; //define principle amount
n=3; //define time
r=8.5; //define rate
/*formula for simple interest*/
si=(p*n*r)/100;
printf("\nSimple interest is : %f",si);
float r,si; //declare decimal type variable
p=1000; //define principle amount
n=3; //define time
r=8.5; //define rate
/*formula for simple interest*/
si=(p*n*r)/100;
printf("\nSimple interest is : %f",si);
getch();
}
Explanation:
- इस program में सारी value pre-defined use की है इसमें user कोई इनपुट नही देगा
- इसमें मैंने दो variable p तथा n int(integer) type के लिए है जिसका अर्थ है कि ये variable केवल integer value ही store करेंगे
- दो variable r तथा si float(दशमलव) type के लिए है जिनका अर्थ है ये integer के साथ साथ दशमलव value भी store कर सकते है
- variable declare करने के बाद उनकी value भी मैंने दे दी जो कि निम्न है p=1000, n=3,r=8.5 value initialize करते समय last में semicolon (;) जरुर लगाते है
- इसके बाद p, n तथा r तीनो को multiply कर 100 से divide कर दिया जिसके फलस्वरूप जो भी value आयेगी वो मैंने si variable में store करा दी
- last में si सेव value को printf function के जरिये console screen पर प्रिंट करवा दिया
- इसमें मैंने कई जगह कमेंट दी है जिससे program को समझना आसान हो जाता है सिंगल line कमेंट के लिए हम डबल स्लैश (//) का तथा दो या दो से अधिक लाइन्स की कमेंट देने के लिए हम उस कमेंट को /*...*/ के बीच में लिखते है हम कमेंट्स में जो नही देते है compiler उसे ignore कर देता है
No comments