JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now

हिंदी माध्यम नोट्स

Categories: c++ language in hindi

write a program to calculate notes in the amount , check valid entry or sides of the triangle with explanation in hindi

check valid entry or sides of the triangle with explanation in hindi , write a program to calculate notes in the amount :-
इससे से पहले के article मे पैटर्न के उदाहरनो को discuss किया था | अब इस article मे c++ language मे कुछ और उदाहरनो को discuss करेगे जिससे आप सभी c++ language के syntax मे बहुत ही अच्छे होते है |
1.Program 1
write a program to calculate notes in the amount.
Expalnation
सबसे पहले यूजर द्वारा amount को input करता है |
इसके बाद यूजर द्वारा declare किये गये amount variable मे assign किया जाता है |
इसमें अलग अलग नोट्स जैसे 500,500,100,50,20,10 आदि के value को hold करता है |
अगर amount की value 2000 से बड़ी होती है तब 2000 की value amount / 2000 statement से calculate किया जाता है | इसके बाद amount को amount – note2000*2000 update किया जाता है |
अगर amount की value 500 से बड़ी होती है तब note500 की value amount / 500 statement से calculate किया जाता है | इसके बाद amount को amount – note500*500 update किया जाता है |
अगर amount की value 50 से बड़ी होती है तब note50 की value amount / 50 statement से calculate किया जाता है | इसके बाद amount को amount – note50*50 update किया जाता है |
अगर amount की value 100 से बड़ी होती है तब note की value amount / 100 statement से calculate किया जाता है | इसके बाद amount को amount – note100*100 update किया जाता है |
अगर amount की value 200 से बड़ी होती है तब note200 की value amount / 200 statement से calculate किया जाता है | इसके बाद amount को amount – note200*200 update किया जाता है |
अगर amount की value 20 से बड़ी होती है तब note20 की value amount / 20 statement से calculate किया जाता है | इसके बाद amount को amount – note20*20 update किया जाता है |
#include<iostream.h>
#include<conio.h>
void main()
{
int amount ;
int note2000,note500,note200,note100,note20,note50;
cout<<“Enter Amount : “<<endl;
cin>>amount;
if(amount>2000)
{
note2000=amount/2000;
amopunt = amount – note2000*2000;
}
if(amount>2000)
{
note2000=amount/2000;
amopunt = amount – note2000*2000;
}
if(amount>500)
{
note500=amount/500;
amopunt = amount – note500*500;
}
if(amount>200)
{
note200=amount/200;
amopunt = amount – note200*200;
}
if(amount>100)
{
note100=amount/100;
amopunt = amount – note100*100;
}
if(amount>50)
{
note50=amount/50;
amopunt = amount – note50*50;
}
cout<<“Note od Rs 2000 : “<<note2000<<endl;
cout<<“Note od Rs 500 : “<<note500<<endl;
cout<<“Note od Rs 200 : “<<not200<<endl;
cout<<“Note od Rs 100 : “<<note100<<endl;
cout<<“Note od Rs 50 : “<<note50<<endl;
getch();
}
2.Program 2
write a program to check valid entry or sides of the triangle.
Expalnation
सबसे पहले यूजर द्वारा sides value को input करता है |
इसके बाद यूजर द्वारा declare किये गये variable a,b or c मे assign किया जाता है |
इसके बाद इन variable को function check() मे pass किया जाता है |
check() function से return किये गये value को count मे assign किया जाता है |
अगर count की value ‘1’ होती है तब sides are not perfect display होगा |
अगर count की value ‘0’ होती  है तब sides are perfect display होगा |
check() मे ,
इस function मे तीन conditions को check किया जाता जाता है |
अगर (a+b>c) और (a+c>b) और ( b+c>a) check किया जाता है |
अगर तीनो conditions true होगी तब count की value ‘0’ होगी | अन्यथा count = 1 होगी |
#include<iostream.h>
#include<conio.h>
int check(int , int ,int );
void main()
{
int a,b,c;
cout<<“Enter side1 :”<<endl;
cin>>a;
cout<<“Enter side2 :”<<endl;
cin>>b;
cout<<“Enter side3 :”<<endl;
cin>>c;
int count = check(a,b,c);
if(count==1)
{
cout<<“sides are perfect”;
}
else
{
cout<<“sides are not perfect”.<<endl;
}
getch();
}
int check(int p,int q,int r)
{
if((p+q>r) && (p+r>q) && (q+r>p))
{
count = 0;
}
else{
count =1;
}
return count;
}
3.Program 3
write a program to check valid entry or angles of the triangle.
Expalnation
सबसे पहले यूजर द्वारा angles value को input करता है |
इसके बाद यूजर द्वारा declare किये गये variable a,b or c मे assign किया जाता है |
इसके बाद इन variable को function check() मे pass किया जाता है |
check() function से return किये गये value को count मे assign किया जाता है |
अगर count की value ‘1’ होती है तब angles are not perfect display होगा |
अगर count की value ‘0’ होती  है तब angles are perfect display होगा |
check() मे ,
इस function मे तीन conditions को check किया जाता जाता है |
अगर (a+b+c ==180) को  check किया जाता है |
अगर तीनो conditions true होगी तब count की value ‘0’ होगी | अन्यथा count = 1 होगी |
#include<iostream.h>
#include<conio.h>
int check(int , int ,int );
void main()
{
int a,b,c;
cout<<“Enter angle1 :”<<endl;
cin>>a;
cout<<“Enter angle2 :”<<endl;
cin>>b;
cout<<“Enter angle3 :”<<endl;
cin>>c;
int count = check(a,b,c);
if(count==1)
{
cout<<“angles are perfect”;
}
else
{
cout<<“angles are not perfect”.<<endl;
}
getch();
}
int check(int p,int q,int r)
{
if(p+q+r == 180 )
{
count = 0;
}
else{
count =1;
}
return count;
}
4.Program 4
write a program to calcualate loss और profit.
Expalnation
सबसे पहले यूजर द्वारा  दो value को input करता है |
इसके बाद यूजर द्वारा declare किये गये variable sell_price और cost_price मे assign किया जाता है |
उसके बाद  sell_price और cost_price को check किया जाता है |
अगर sell_price की value cost_price से बड़ी होती है तब profit = sell_price – cost_price को calculate किया जाता है |
अगर sell_price की value cost_price से छोटी  होती है तब profit = cost_price – sell_price को calculate किया जाता है |
इसके बाद  profit और loss की value को print करते है |
#include<iostream.h>
#include<conio.h>
void main()
{
int a,b;
cout<<“Enter cost price :”<<endl;
cin>>a;
cout<<“Enter sell price  :”<<endl;
cin>>b;
if(a>b)
{
int loss = a-b;
cout<<“loss :”<<loss;
}
if(a<b)
{
int profit = b-a;
cout<<“Profit : “<<profit;
}
getch();
}
Sbistudy

Recent Posts

मालकाना का युद्ध malkhana ka yudh kab hua tha in hindi

malkhana ka yudh kab hua tha in hindi मालकाना का युद्ध ? मालकाना के युद्ध…

4 weeks ago

कान्हड़देव तथा अलाउद्दीन खिलजी के संबंधों पर प्रकाश डालिए

राणा रतन सिंह चित्तौड़ ( 1302 ई. - 1303 ) राजस्थान के इतिहास में गुहिलवंशी…

4 weeks ago

हम्मीर देव चौहान का इतिहास क्या है ? hammir dev chauhan history in hindi explained

hammir dev chauhan history in hindi explained हम्मीर देव चौहान का इतिहास क्या है ?…

4 weeks ago

तराइन का प्रथम युद्ध कब और किसके बीच हुआ द्वितीय युद्ध Tarain battle in hindi first and second

Tarain battle in hindi first and second तराइन का प्रथम युद्ध कब और किसके बीच…

4 weeks ago

चौहानों की उत्पत्ति कैसे हुई थी ? chahamana dynasty ki utpatti kahan se hui in hindi

chahamana dynasty ki utpatti kahan se hui in hindi चौहानों की उत्पत्ति कैसे हुई थी…

1 month ago

भारत पर पहला तुर्क आक्रमण किसने किया कब हुआ first turk invaders who attacked india in hindi

first turk invaders who attacked india in hindi भारत पर पहला तुर्क आक्रमण किसने किया…

1 month ago
All Rights ReservedView Non-AMP Version
X

Headline

You can control the ways in which we improve and personalize your experience. Please choose whether you wish to allow the following:

Privacy Settings
JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now