हिंदी माध्यम नोट्स
C++ : Example , Write a program to convert a height value in feet into feet value , BMI( body mass index )
उदाहरण- 1
Write a program to convert a height value in feet into feet value.
Explanation
सबसे पहले दो variables को declare करते है | जिसमे एक का type integer और दूसरा का type float है |
उसके बाद यूजर से height value ( जो inch मे होगी ) को input करा लेगे | इसे variable name ‘h’
मे assign किया जाता है |
इसके बाद यूजर द्वारा input किये गये height value को feet मे convert करके variable h1 मे assign किया जाता है |
इसके बाद इन converted value को cout statement से display करा लेते है |
Source Code
#include<iostream.h>
#include<conio.h>
void mian ()
{
using namespace std;
int h;
float h1;
cout<<“Enter height value (in Inch ) :”<<endl;
cin>>h;
h1=h*0.0833;
cout<<“Height value (in Foot ) : “<<h1<<endl;
getch();
}
इसका आउटपुट होगा :
Enter height value (in Inch ) : 6
Height value (in Foot ) : 0.50उदाहरण- 2
Write a program to calculate BMI( body mass index ).
Explanation
BMI( body mass index ) एक ration होता है जोकि weight in kilogram और height in foot से calculate किया जाता है | इस उदाहरण मे , यूजर से height को inch मे और weight को pound मे लिया जाता है | और बाद मे BMI को calculate किया जाता है |
सबसे पहले दो variables को declare करते है | जिसमे height को inch मे और weight को pound की value को assign किया जाता है |
उसके बाद यूजर से height value ( जो inch मे होगी ) को input करा लेगे | इसे variable name ‘h’
मे assign किया जाता है और यूजर से weight value ( जो pound मे होगी ) को input करा लेगे | इसे variable name ‘w’ मे assign किया जाता है |
इसके बाद यूजर द्वारा input किये गये height value को feet मे convert करके variable h1 मे assign किया जाता है | और यूजर द्वारा input किये गये weight value को kilogram मे convert करके variable w1 मे assign किया जाता है |
उइसके बाद body mass index = weight value / height value ; से BMI को calclaute किया जाता है |
इसके बाद इन BMI value को cout statement से display करा लेते है |
Source Code
#include<iostream.h>
#include<conio.h>
void mian ()
{
using namespace std;
int h,w;
float h1,w1;
cout<<“Enter height value (in Inch ) :”<<endl;
cin>>h;
h1=h*0.0833;
cout<<“Height value (in Foot ) : “<<h1<<endl;
cout<<“Enter weight value (in Pound) :”<<endl;
cin>>w;
w1=w/2.2;
cout<<“Weight value (in Kilogram ) : “<<w1<<endl;
float i= w1/hValue ;
cout<<“BMI Value “<<i;
getch();
}
इसका आउटपुट होगा :
Enter height value (in Inch ) : 6
Height value (in Foot ) : 0.50
Enter height value (in Pound ) : 6
Weight value (in Kilogram ) : 3.3
BMI Value =
उदाहरण-
Write a program to calculate car efficiency in miles per gallons. and convert it into Indian style ( kilogram per liter).
Explanation
car efficiency in miles per gallons एक ration होता है जोकि distance in miles और oli capacity in gallon से calculate किया जाता है | इस उदाहरण मे , यूजर से distance को mile मे और oil capacity को gallons मे लिया जाता है | और बाद मे miles per gallons को calculate किया जाता है |
सबसे पहले दो variables को declare करते है | जिसमे distance value को mile मे और oil capacity को gallon की value को assign किया जाता है |
उसके बाद यूजर से distance value ( जो mile मे होगी ) को input करा लेगे | इसे variable name ‘d’
मे assign किया जाता है और यूजर से oil capacity value ( जो gallon मे होगी ) को input करा लेगे | इसे variable name ‘c’ मे assign किया जाता है |
इसके बाद यूजर द्वारा input किये गये height value को kilogram मे convert करके variable d1 मे assign किया जाता है | और यूजर द्वारा input किये गये oil capacity value को litres मे convert करके variable c1 मे assign किया जाता है |
उइसके बाद से efficiency = distance value /oil capacity value ; को calculate किया जाता है |
इसके बाद इन efficiency value को cout statement से display करा लेते है |
Source Code
#include<iostream.h>
#include<conio.h>
void mian ()
{
using namespace std;
int d,c;
float d1,c1;
cout<<“Enter distance value (In Mile ) :”<<endl;
cin>>d;
d1=(d*100)/62.14;
cout<<“Distance value (in Kilometer ) : “<<d1<<endl;
cout<<“Enter oil capacity value (In gallon ) :”<<endl;
cin>c;
c1=c*3.875;
cout<<“oil capacity value (In Litres) : “<<w1<<endl;
float i= d1/c1 ;
cout<<” Efficiency Value “<<i;
getch();
}
उदाहरण- 4
Write a program to calculate square of a number .
Explanation
सबसे पहले दो variables को declare करते है | जिसमे एक का type integer और दूसरा का type float है |
उसके बाद यूजर से value को input करा लेगे | इसे variable name ‘a’ मे assign किया जाता है |
इसके बाद यूजर द्वारा input किये गये value से square को calculate करके variable s मे assign किया जाता है |
इसके बाद इन square value को cout statement से display करा लेते है |
Source Code
#include<iostream.h>
#include<conio.h>
void main ()
{
using namespace std;
int a;
float s;
cout<<“Enter value :”<<endl;
cin>>a;
s=a*a;
cout<<“Square value : “<<s<<endl;
getch();
}
इसका आउटपुट होगा :
Enter value : 3
Square value : 9
उदाहरण- 5
Write a program to calculate cube of a number .
Explanation
सबसे पहले दो variables को declare करते है | जिसमे एक का type integer और दूसरा का type float है |
उसके बाद यूजर से value को input करा लेगे | इसे variable name ‘a’ मे assign किया जाता है |
इसके बाद यूजर द्वारा input किये गये value से cube को calculate करके variable q मे assign किया जाता है |
इसके बाद इन cube value को cout statement से display करा लेते है |
Source Code
#include<iostream.h>
#include<conio.h>
void main ()
{
using namespace std;
int a;
float s;
cout<<“Enter value :”<<endl;
cin>>a;
s=a*a*a;
cout<<“Cube value : “<<s<<endl;
getch();
}
इसका आउटपुट होगा :
Enter value : 3
Cube value : 27
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 ,…