JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now

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

Class 6

Hindi social science science maths English

Class 7

Hindi social science science maths English

Class 8

Hindi social science science maths English

Class 9

Hindi social science science Maths English

Class 10

Hindi Social science science Maths English

Class 11

Hindi sociology physics physical education maths english economics geography History

chemistry business studies biology accountancy political science

Class 12

Hindi physics physical education maths english economics

chemistry business studies biology accountancy Political science History sociology

Home science Geography

English medium Notes

Class 6

Hindi social science science maths English

Class 7

Hindi social science science maths English

Class 8

Hindi social science science maths English

Class 9

Hindi social science science Maths English

Class 10

Hindi Social science science Maths English

Class 11

Hindi physics physical education maths entrepreneurship english economics

chemistry business studies biology accountancy

Class 12

Hindi physics physical education maths entrepreneurship english economics

chemistry business studies biology accountancy

Categories: c++ language in hindi

C++ : Operator Example with program explanation in hindi , write a program to find even or odd number

learn about C++ : Operator Example with program explanation in hindi :-
इससे पहले के article मे operators को discuss किया गया है | अब इस article मे इन operators पर based उदाहरनो को discuss करेगे | जिनसे आपके इन सभी  operators के concept को अच्छी तरह से समज सकते है |
Example 1
write a program to find even or odd number .
Explanation
1.सबसे पहले एक array को declare किया जाता है |  जिसकी size 5 है अतः इसमें 5 values assign की जाती है |
2. looping चलाया जाता है |
3.loop की  body मे , array के element पर even और odd की condition को check किया जाता है |
जब i=0 होती है तब array की first element पर even और odd की condition को check किया जाता है |
जब i=1 होती है तब array की second element पर even और odd की condition को check किया जाता है |
जब i=2 होती है तब array की  third element पर even और odd की condition को check किया जाता है |
जब i=3 होती है तब array की fourth element पर even और odd की condition को check किया जाता है |
जब i=4 होती है तब array की  fifth element पर even और odd की condition को check किया जाता है |
अगर element even होता है तब a[i] is even . display होता है अन्यथा  a[i] is odd .display होता है |
4. प्रोग्राम को क्लोज कर देते है |
source code
#include<iostream.h>
#include<conio.h>
void main()
{
int a[5];
cout<<“Enter Array Date :”<<endl;
for(i=0;i<5;i++)
{
cin>>a[i];
}
for(i=0;i<5;i++)
{
if(a[i]%2 ==0)
{
cout<<a[i]<<“is even.”<<endl;
}
else
{
cout<<a[i]<<“is odd.”<<endl;
}
getch();
}
इसका आउटपुट होगा :-
Enter Array Date : 12 23 11 24 32
12 is even.
23 is odd.
11 is odd.
24 is even.
32 is even.
Example 2
write a program to find even or odd number using Bitwise operator .
Explanation
1.सबसे पहले एक array को declare किया जाता है |  जिसकी size 5 है अतः इसमें 5 values assign की जाती है |
2. looping चलाया जाता है |
3.loop की  body मे , array के element पर even और odd की condition को check किया जाता है | even or odd condition को bitwise and operator के लिए use किया जाता है |
किसी value की बिट पैटर्न का  most right बिट से value के even और odd को check करने के use किये जाता है | अगर right most बिट ‘1’ होती तब value even होती है अन्यथा odd होती है |
जब i=0 होती है तब array की first element पर even और odd की condition को check किया जाता है |
जब i=1 होती है तब array की second element पर even और odd की condition को check किया जाता है |
जब i=2 होती है तब array की  third element पर even और odd की condition को check किया जाता है |
जब i=3 होती है तब array की fourth element पर even और odd की condition को check किया जाता है |
जब i=4 होती है तब array की  fifth element पर even और odd की condition को check किया जाता है |
अगर element even होता है तब a[i] is even . display होता है अन्यथा  a[i] is odd .display होता है |
4. प्रोग्राम को क्लोज कर देते है |
source code
#include<iostream.h>
#include<conio.h>
void main()
{
int a[5];
cout<<“Enter Array Date :”<<endl;
for(i=0;i<5;i++)
{
cin>>a[i];
}
for(i=0;i<5;i++)
{
if(a[i]& 1)
{
cout<<a[i]<<“is even.”<<endl;
}
else
{
cout<<a[i]<<“is odd.”<<endl;
}
getch();
}
इसका आउटपुट होगा :-
Enter Array Date : 12 23 11 24 32
12 is even.
23 is odd.
11 is odd.
24 is even.
32 is even.
Example 3
write a program to find averge of 10 values .
Explanation
1.सबसे पहले एक array को declare किया जाता है |  जिसकी size 10 है अतः इसमें 10 values assign की जाती है |
2. looping चलाया जाता है |
3.loop की  body मे , array के element को add किया जाता है  | जिसे sum variable मे assign किया  जाता है |
जब i=0 होती है तब array की first element को sum =0 से add  किया जाता है |
जब i=1 होती है तब array की second element , sum से add किया जाता है |
जब i=2 होती है तब array की  third element, sum (जिसमे first और second element का addition होता है  ) को add किया जाता है |
जब i=3 होती है तब array की fourth element sum (जिसमे first,second और third element का addition होता है  ) को add किया जाता है |
इस तरह से array के सभी 10 values को add करके sum variable मे assign कर दिया जाता है |
4.फिर average = sum / Number of values ; से average को calculate कर लिया जाता है |
5. average की value को display कर दिया जाता है |
source code
#include<iostream.h>
#include<conio.h>
void main()
{
int a[10];
cout<<“Enter Array Date :”<<endl;
for(i=0;i<10;i++)
{
cin>>a[i];
}
for(i=0;i<10;i++)
{
sum+=a[i];
}
int avg= sum/10;
cout<<“Average :”<<avg<<endl;
getch();
}
इसका आउटपुट होगा :-
Enter Array Date : 11 24 32 11 22 32 43 67 78 98
Average : 41.8
Example 4
write a program to print table of number .
Explanation
1.सबसे पहले यूजर द्वारा number को input करा लेते है जिसके tabel को  print करना है |
2.उसके बाद looping की जाती है |
3.loop के body मे , variable mul = number * i से tabel की value को find कर लिया जाता है |
4. उसके बाद cout statement से  number * i = mul को display करदिया जाता है |
5.ये loop 10 बार चलाया जाता है |
source code
#include<iostream.h>
#include<conio.h>
void main()
{
int mul,number ,i;
cout<<“Enter number : “<<endl;
cin>>number;
cout<< “Table of “<<number<<endl;
for(i=1;i<=10;i++)
{
mul=number i;
cout<<number <<“*”<< i <<“=”<< mul<<endl;
}
getch();
}
इसका आउटपुट होगा :-
Enter number : 4
Table of 4
4*1=4
4*2=8
4*3=12
4*4=16
4*5=20
4*6=24
4*7=28
4*8=32
4*9=36
4*10=40
Example 5
write a program to find third angel of a triangle  .
Explanation
1.सबसे पहले यूजर द्वारा दो angle के value को input करा लेते है जिसे angle1 और angle2 मे assign करा देते है |
2.उसके बाद angle3 = 180 – (angle1+angle2) से तिरसा angle को calculate कर लिया जाता है |
3.इस तीरसे angle को display कर दिया जाता है |
source code
#include<iostream.h>
#include<conio.h>
void main()
{
int angle1 ,angle2 ,angle3 ;
cout<<“Enter angle1  : “<<endl;
cin>>angle1 ;
cout<<“Enter angle2  : “<<endl;
cin>>angle2 ;
angle3 = 180- (angle1 + angle2);
cout<<“Third Angel : “<<angle3;
getch();
}
इसका आउटपुट होगा :-
Enter angle1  : 70
Enter angle2  : 50
Third Angel : 60
Sbistudy

Recent Posts

four potential in hindi 4-potential electrodynamics चतुर्विम विभव किसे कहते हैं

चतुर्विम विभव (Four-Potential) हम जानते हैं कि एक निर्देश तंत्र में विद्युत क्षेत्र इसके सापेक्ष…

2 days ago

Relativistic Electrodynamics in hindi आपेक्षिकीय विद्युतगतिकी नोट्स क्या है परिभाषा

आपेक्षिकीय विद्युतगतिकी नोट्स क्या है परिभाषा Relativistic Electrodynamics in hindi ? अध्याय : आपेक्षिकीय विद्युतगतिकी…

4 days ago

pair production in hindi formula definition युग्म उत्पादन किसे कहते हैं परिभाषा सूत्र क्या है लिखिए

युग्म उत्पादन किसे कहते हैं परिभाषा सूत्र क्या है लिखिए pair production in hindi formula…

6 days ago

THRESHOLD REACTION ENERGY in hindi देहली अभिक्रिया ऊर्जा किसे कहते हैं सूत्र क्या है परिभाषा

देहली अभिक्रिया ऊर्जा किसे कहते हैं सूत्र क्या है परिभाषा THRESHOLD REACTION ENERGY in hindi…

6 days ago

elastic collision of two particles in hindi definition formula दो कणों की अप्रत्यास्थ टक्कर क्या है

दो कणों की अप्रत्यास्थ टक्कर क्या है elastic collision of two particles in hindi definition…

6 days 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