Hello World Program
Unary Operators


#include<stdio.h>
#include<conio.h>
#include<iostream.h>

void main()
{
clrscr();
cout<<"Welcome to  Hello World ";
getch();
}

UnaryMinus

/* Unary minus Program*/
#include<stdio.h>
#include<conio.h>
#include<iostream.h>

using namespace std;
void main()
{
	int x;
	cout<<"enter x value";
	cin>>x;
    cout<<"The sign value is "<<-x;
	getch();

}

PreIncrement Operaator(++x)

/* Unary PreIncrement Program*/

#include<stdio.h>
#include<conio.h>
#include<iostream.h>

using namespace std;
void main()
{
	int x;
	cout<<"enter x value";
	cin>>x;
    cout<<"The pre Increment value is "<<++x;
	getch();

}

PostIncrement Operaator(x++)

/* Unary PostIncrement Program*/
#include<stdio.h>
#include<conio.h>
#include<iostream.h>

using namespace std;
void main()
{
	int x;
	cout<<"enter x value";
	cin>>x;
    cout<<"The pre Increment value is "<
 

PreDecrement Operaator(- -x)


/* Unary PreDecrement Program*/

#include<stdio.h>
#include<conio.h>
#include<iostream.h>

using namespace std;
void main()
{
	int x;
	cout<<"enter x value";
	cin>>x;
    cout<<"The pre Increment value is "<<--x;
	getch();

}

PostDecrement Operaator(x- -)

#include<stdio.h>
#include<conio.h>
#include<iostream.h>

using namespace std;
void main()
{
	int x;
	cout<<"enter x value";
	cin>>x;
    cout<<"The pre Increment value is "<
 

Arithmetic Operators
Binary Operators
#include<stdio.h> #include<conio.h> #include<iostream.h> using namespace std; void main() { int x,y,add,sub,mul,div,mod; cout<<"enter x,y value"; cin>>x>>y; add=x+y; sub=x-y; mul=x*y; div=x/y; mod=x%y; cout<<"Addition of two numbers is "<

Swaping Of Two Numbers

#include<stdio.h>
#include<conio.h>
#include<iostream.h>

using namespace std;
void main()
{
	int x,y,z;
	cout<<"enter x,y value";
	cin>>x>>y;
	cout<<"Before Swaping";
	cout<<"\nx valie  is"<
 

Swaping Of Two Numbers Without Using Third Variable
#include<stdio.h>
#include<conio.h>
#include<iostream.h>

using namespace std;
void main()
{
	int x,y;
	cout<<"enter x,y value";
	cin>>x>>y;
	cout<<"Before Swaping";
	cout<<"\nx valie  is"<
 

Relational Operators
#include<stdio.h> #include<conio.h> #include<iostream.h> using namespace std; void main() { int x,y,equal,greater,lesser,greaterequal,lesserequal,notequal; cout<<"enter x,y value"; cin>>x>>y; equal = x ==y; greater = x > y; lesser = x < y; greaterequal = x>=y; lesserequal = x <= y; notequal = x!=y; cout<<"\nThe value of x==y ="<< equal; cout<<"\nThe value of x=>y = "<< greater; cout<<"\nThe value of x=y = "<< greaterequal; cout<<"\nThe value of x<=y = "<< lesserequal; cout<<"\nThe value of x!=y = "<< notequal; cout<<"\ntrue =1 \nfalse =0 "; getch(); }

BItwise Operators
#include<stdio.h> #include<conio.h> #include<iostream.h> using namespace std; void main() { int x,y,and,or,cap,nagetion,leftshift,rightshift; cout<<"enter x,y value"; cin>>x>>y; and=x&y; or=x|y; cap=x^y; nagetion=~x; leftshift=x<<2; rightshift=x>>2; cout<<"\nbitwise x&y = "<>2 = "<

ODD or EVEN using ternary
Ternary Operators
#include<stdio.h> #include<conio.h> #include<iostream.h> using namespace std; void main() { int x; cout<<"enter x value"; cin>>x; x%2==0? cout<<"Even":cout<<"Odd"; getch(); }

Max Number Using Ternary
#include<stdio.h> #include<conio.h> #include<iostream.h> using namespace std; void main() { int x,y; cout<<"enter x, y vlues"; cin>>x>>y; x>y? cout<<"x is max":cout<<"y is max"; getch(); }

Odd or Even number Using IF-ELSE

#include<stdio.h>
#include<conio.h>
#include<iostream.h>

using namespace std;
void main()
{
int n;
cout<<"Enter n value";
cin>>n;
if(n%2==0)
{
cout<<"Even number";
}
else
{
cout<<"Odd number";
}
getch();
}


Max Number Program Using IF-ELSE

#include<stdio.h>
#include<conio.h>
#include<iostream.h>

using namespace std;
void main()
{
int x,y;
cout<<"Enter x ,y values";
cin>>x>>y;
if(x>y)
{
cout<<"x is max number";
}
else
{
cout<<"y is max number";
}
getch();
}


Check The Given Number Is Valid Or Invalid (Value Must be 20 To 30 Between

#include<stdio.h>
#include<conio.h>
#include<iostream.h>

using namespace std;
void main()
{
int x;
cout<<"Enter x value";
cin>>x;
if(x>=20 && x<=30)
{
cout<<"Valid Number;
}
else
{
cout<<"Invalid Number";
}
getch();
}

Voewl Consonant Program Using IF-ELSE

#include<stdio.h>
#include<conio.h>
#include<iostream.h>

using namespace std;
void main()
{

char ch;
cout<<"Enter charactor";
cin>>ch;
if(ch>='a' && ch<='z')
{
if(ch=='a'|| ch=='e'||ch=='i'||ch=='o'||ch=='u')
{
cout<<"Vowel";
}
else
{
cout<<"Consonant";
}
}
else
{
cout<<"Please enter Small letters only";
}
getch();
}

Check Your Age Program using ELSE-IF

#include<stdio.h>
#include<conio.h>
#include<iostream.h>

using namespace std;
void main()
{
clrscr();
int age;
cout<<"Enter your age";
cin>>age;
if(age>0&& age<=12)
{
cout<<"You are a child age";
}
else if(age>12 && age<=19)
{
cout<<"You are a teenage";
}
else if(age>19 && age<=40)
{
cout<<"You are a Younger";
}
else if(age>40 && age<=80)
{
cout<<"You are a oldage";
}
else if(age>80 && age<=100)
{
cout<<"You are a too oldage";
}
else
{
cout<<"Invalid age";
}
getch();
}

Nested IF Condition
#include<stdio.h> #include<conio.h> #include<iostream.h> using namespace std; void main() { clrscr(); int age; cout<<"Enter your age"; cin>>age; if(age>0) { if(age>0&& age<=12) { cout<<"You are a child age"; } else if(age>12 && age<=19) { cout<<"You are a teenage"; } else if(age>19 && age<=40) { cout<<"You are a Younger"; } else if(age>40 && age<=80) { cout<<"You are a oldage"; } else if(age>80 && age<=100) { cout<<"You are a too oldage"; } else { cout<<"Invalid age"; } } else { cout<<"Age should not be negetive"; } getch(); }

Max Number Program Using Amoung Three Numbers
#include<stdio.h> #include<conio.h> #include<iostream.h> using namespace std; void main() { int x,y,z; cout<<"Enter x,y ,z values"; cin>>x>>y>>z; if(x>y && x>z) { cout<<"x is max"; } else if(y>x && y>z) { cout<<"y is max"; } else if(z>x && z>y) { cout<<"z is max"; } else { cout<<"Invalid Number"; } getch(); }

Vowel Consonant Program Using Switch

#include<stdio.h>
#include<conio.h>
#include<iostream.h>

using namespace std;
void main()
{
char ch;
cout<<"enter Character";
cin>>ch;
switch(ch)
{
case 'a':
     
case 'e':
       
case 'i':
      
case 'o':
       
case 'u':
      cout<<"vowel";
       break;
default:
	cout<<"consonent";
}
getch();
}

Simple Calculator Program Using Switch

#include<stdio.h>
#include<conio.h>
#include<iostream.h>

using namespace std;
void main()
{
int x;
int y;
int choice;
cout<<"1.addition";
cout<<"\n2.subtraction";
cout<<"\n3.multplication";
cout<<"\n4.divsioni";
cout<<"\n5.modular division";
cout<<"enter your choice";
cin>>choice;
cout<<"enter x,y";
cin>>x>>y;
switch(z)
{
case 1:

      cout<<"addition"<<(x+y);
      break;
case 2:
       cout<<"sudtrction"<<(x-y);
       break;
case 3:
       cout<<"multiplication "<<(x*y);
       break;
case 4:
       cout<<"division "<<(x/y));
       break;
case 5:
       cout<<"modular division"<<(x%y));
       break;
default:
	cout<<"invalied choice";
}
getch();
}

ODD or Even Number Program Using Switch

#include<stdio.h>
#include<conio.h>
#include<iostream.h>

using namespace std;
void main()
{
int x,y;
cout<<"enter x";
cin>>x
y=x%2;
switch(y)
{
case 0:
      cout<<"Even";
       break;
case 1:
       cout<<"Odd";
       break;
default:
	cout<<"Invalid Choice";
}
getch();
}

Display 1 TO 10 Numbers Using FOR-LOOP

#include<stdio.h>
#include<conio.h>
#include<iostream.h>

using namespace std;
void main()
{
int x;
for(x=1;x<=10;x++)
{
cout<<"\n" <<x;
}
getch();

Display 10 To 1 Values Using FOR-LOOP

#include<stdio.h>
#include<conio.h>
#include<iostream.h>

using namespace std;
void main()
{
int x;
for(x=10;x>=1;x--)
{
cout<<"\n"<<x;
}
getch();
}