हिंदी माध्यम नोट्स
Write a program to sum all values between a range , simple or compound interest , manage sale report monthly wise
Write a program to sum all values between a range.
इस उदाहरन मे , किसी range मे सभी values को add किया जाता है |
Explanation
सबसे पहले यूजर द्वारा range को input कराया जाता है | range मे upper और lower limit को input किया जाता है | जिससे lower और upper variable मे assign कर दिया जाता है |
इसके बाद loop चलाया जाता है | loop मे condition lower <=upper होती है | ये loop तब तक चलता है जब तक lower की value upper के सामान नहीं हो जाती है |
इस loop की body मे , sum = sum + lower
इसके बाद sum की value को display किया जाता है |
source code
#include<iostream.h>
#include<conio.h>
void main()
{
int lower , upper ;
int sum;
cout<<“Enter lower Limit :”;
cin>>lower ;
cout<<“Enter Upper Limit :”;
cin>>upper ;
for(lower = lower ; lower <=upper ; lower + 1 )
{
sum = lower +sum ;
}
cout<<“Sum of all values between “<<lower <<“or”<<upper<<“is”<<sum;
getch();
}
इसका आउटपुट होगा
Enter lower Limit : 2
Enter Upper Limit : 9
Sum of all values between 2 or 9 is 44.
Example 2
write a program to find simple or compound interest.
इस उदाहरन मे , simple or compound interest को find किया जाता है |
Explanation
सबसे पहले यूजर द्वारा interest को calculate करने के लिए principal , time और rate को input किया किया जाता है |
यूजर द्वारा in value को input किया जाता है | in value को principal , time और rate मे assign किया जाता है |
इसके बाद SI= principal * time * rate /100; से simple interest किया जाता है |
और copound interest के लिए loop चलाया जाता है |
इस loop , year की value तक चलाया जाता है | इस loop की body मे ,
principal मे principal + interest को add किया जाता है | हर बार principal की value मे intrest को add किया जाता है |
last मे , simple intrest और compound intrest को display करता है |
source code
#include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
int p,r,t;
int CI =0 ;
cout<<“Enter Principal :”;
cin>>p;
cout<<“Enter Rate :”;
cin>>r;
cout<<“Enter Time :”;
cin>>t;
int SI = p*r*i /100;
for (int i = 1 ;i<=t;i++)
{
int I = p*r*t /100;
p=p+I;
CI = CI+I;
}
cout<<“Simple Interest : “<<SI<<endl;
Cout<<“Compund Intrest : “<<CI<<endl;
getch();
}
इसका आउटपुट होगा :
Enter Principal : 1000
Enter Rate : 10
Enter Time : 2
Simple Interest :200
Compund Intrest :211
Example 3
write a program to manage sale report monthly wise .
इस उदाहरन मे , किसी शॉप के लिए sale report को monthly wise manage किया जाता है |
Explanation
सबसे पहले array report को declare किया जाता है | इस array की size ’12’ होती है | जिसमे monthly wise sale figure को hold किया जाता है |
इसके बाद loop चलाया जाता है \ इस loop मे निन्म function को perform किया जाता है |
यूजर द्वारा mothly wise sale figure को input किया जाता है | और इस value को array report मे assign किया जाता है |
इसके बाद loop चलाया जाता है | इस loop की body मे , array के value को print किया जाता है |
इसके बाद array के सभी value को add किया जाता है | जो की पुरे वर्ष के लिए total sale का figure होता है |
source code
#include<iostream.h>
#include<conio.h>
enum Month {january , Feberaury , March , April , May, June ,July ,August , September , Octomber , November , Deceember }
{
array report[12];
int sum =0 ;
for(int i =0 ; i<12; i++)
{
Cout<<“Enter Sale Figure for”<<i<<“:”<<endl;
con>>report[i];
sum = sum + report [i];
}
for (int i =0 ; i<12; i++)
{
Cout<<“Enter Sale Figure for”<<i<<“:”<<report[i];
}
cout<<“Total sale : “<<sum ;
getch();
}
इसका आउटपुट होगा :
Enter Sale Figure for january : 1200
Enter Sale Figure for Feberaury : 2300
Enter Sale Figure for March : 3400
Enter Sale Figure for April :4500
Enter Sale Figure for May : 3467
Enter Sale Figure for June : 5678
Enter Sale Figure for July : 8976
Enter Sale Figure for August :9087
Enter Sale Figure for September : 7865
Enter Sale Figure for Octomber : 8976
Enter Sale Figure for November : 7865
Enter Sale Figure for Deceember : 8900
Example 4
write a program to find grade according to the marks .
इस उदाहरन मे , दिए गये marks के आधार grade को find किया जाता है |
Explanation
सबसे पहले यूजर द्वारा marks को declare किया जाता है | उसके बाद यूजर द्वारा marks को input किया जाता है | इस value को marks variable मे assign कर दिया जाता है |
switch statement मे यूजर द्वारा input mark को लिखा जाता है | grade करने के लिए निन्म case value होती है |
mark की value 70 से उपर होती है अगर grade ‘honour ‘ होती है |
mark की value 60 और 70 के बीच होती है अगर grade ‘first class ‘ होती है |
mark की value 50 और 60 के बीच होती है अगर grade ‘second class ‘ होती है |
mark की value 40 और 50 के बीच होती है अगर grade ‘ third class ‘ होती है |
default case मे fail होने का message display होता हो |
switch statement मे case lable मे यूजर द्वारा input किये गये mark को लिखा जाता है | और उसके अनुसार message को display किया जाता है |
source code
#include<iostream.h>
#include<conio.h>
void main()
{
char grade ;
cout<<“Enter grade : “;
cin>>grade;
switch(grade)
{
case ‘honour’ :
cout<<“your marks is above 70 .”;
break;
case ‘first ‘ :
cout<<“your marks is between 60 to 70 .”;
break;
case ‘second ‘ :
cout<<“your marks is between 50 to 60 .”;
break;
case ‘third’ :
cout<<“your marks is between 40 to 50 .”; “;
break;
defalut :
cout<<“You are fail. “;
break;
}
getch();
}
इसका आउटपुट होगा :
Enter grade : first
your marks is between 60 to 70 .
इस article मे switch statement पर based चार उदाहरनो को discuss किया जाता है | जिससे प्रोग्रामर प्रोग्रामिंग के लिए जरुरी skills को develop कर सके |
Recent Posts
सती रासो किसकी रचना है , sati raso ke rachnakar kaun hai in hindi , सती रासो के लेखक कौन है
सती रासो के लेखक कौन है सती रासो किसकी रचना है , sati raso ke…
मारवाड़ रा परगना री विगत किसकी रचना है , marwar ra pargana ri vigat ke lekhak kaun the
marwar ra pargana ri vigat ke lekhak kaun the मारवाड़ रा परगना री विगत किसकी…
राजस्थान के इतिहास के पुरातात्विक स्रोतों की विवेचना कीजिए sources of rajasthan history in hindi
sources of rajasthan history in hindi राजस्थान के इतिहास के पुरातात्विक स्रोतों की विवेचना कीजिए…
गुर्जरात्रा प्रदेश राजस्थान कौनसा है , किसे कहते है ? gurjaratra pradesh in rajasthan in hindi
gurjaratra pradesh in rajasthan in hindi गुर्जरात्रा प्रदेश राजस्थान कौनसा है , किसे कहते है…
Weston Standard Cell in hindi वेस्टन मानक सेल क्या है इससे सेल विभव (वि.वा.बल) का मापन
वेस्टन मानक सेल क्या है इससे सेल विभव (वि.वा.बल) का मापन Weston Standard Cell in…
polity notes pdf in hindi for upsc prelims and mains exam , SSC , RAS political science hindi medium handwritten
get all types and chapters polity notes pdf in hindi for upsc , SSC ,…