Wednesday, 20 November 2013

If else if Statements

# include<iostream> using namespace std; void main() { cout<<"Enter any number"; cin>>a; if(a==0) cout<<"value of a is o"<<endl; else if(a==2) cout<<"Value of a is 2"<<endl; else if(a==3) cout<<"Value of a is 3"<<endl; else  cout<<"Value of a is not 0,2 and 3"<<endl; } In this program, we...

If else Statement

# include<iostream> using namespace std; void main() { cout<<"Enter any number"; cin>>a; if(a==0) cout<<"value of a is o"<<endl; else cout<<"Value of a is not zero"<<endl; } In this program, we will take value from user,the value user gives is store in a(data type int) If the user give inout o(zero),then the...

If statement

# include<iostream> using namespace std; void main() { cout<<"Enter any number"; cin>>a; if(a==0) cout<<"value of a is o"<<endl; } In this program, we will take value from user,the value user gives is store in a(data type int) If the user give inout o(zero),then the program says that:- "Value of a is o".......!! How is this possible,Actually...

Thursday, 7 November 2013

Do While Loop

Practise Programe of  Do While Loop.   # include<iostream> using namespace std; void main() { int a,b; char ch; do { cout<<"Enter a"; cin>>a; cout<<"Enter b"; cin>>b; a=a+b; cout<<"output is"<<a<<endl; cout<<"Are you want to continue"<<endl; cin>>ch; } while(ch=='Y'||ch=='y'); } The basic difference...

While Loop

# include<iostream> using namespace std; void main() { int a; a=0; while(a<=10) { cout<<a<<endl; a++; } } This program is same as http://www.jdrana.blogspot.com/2013/10/include-include-void-main-int-i-fori0i.html......! but this is done with the help of while loop The while condition if tress control enter into while loop body,otherwise not.......! As,For...