Friday, 30 September 2016

program to check whether the no is even or odd by switch


#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a;
cout<<"enter the no-:";
cin>>a;
switch(a%2)
{case 0:
cout<<"the number is even";
break;
case 1:
cout<<"the no is odd";
break;
case -1:
cout<<"the number is odd";
break;
default:
cout<<"not valid no";
}
getch();
}

Thursday, 29 September 2016

program to check the month


#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int month;
cout<<"enter the value -:";
cin>>month;
switch(month)
{case 1:
cout<<"january";
break;
case 2:
cout<<"feberuary";
break;
case 3:
cout<<"march";
break;
case 4:
cout<<"april";
break;
case 5:
cout<<"may";
case 6:
cout<<"june";
break;
case 7:
cout<<"july";
break;
case 8:
cout<<"august";
break;
case 9:
cout<<"september";
break;
case 10:
cout<<"october";
break;
case 11:
cout<<"november";
break;
case 12:
cout<<"december";
break;
default:
cout<<"Not valid value";
}
getch();
}

program to divide two numbers


#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,b,c;
cout<<" enter the first number ";
cin>>a;
cout<<" enter the second number ";
cin>>b;
c=a/b;
cout<<" the result is "<<c;
getch();
}

program of to check the day


#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int day;
cout<<"enter the value -:";
cin>>day;
switch(day)
{case 1:

cout<<"Monday";
break;
case 2:
cout<<"Tuesday";
break;
case 3:
cout<<"Wednesday";
break;
case 4:
cout<<"Thursday";
break;
case 5:
cout<<"Friday";
break;
case 6:
cout<<"Saturday";
break;
case 7:
cout<<"Sunday";
break;
default:
cout<<"Not valid value";
}
getch();
}

wap to substraction of two numbers


#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,b,c;
cout<<" enter the first number ";
cin>>a;
cout<<" enter the second number ";
cin>>b;
c=a-b;
cout<<" the result is "<<c;
getch();
}

Sunday, 25 September 2016

multiply of two number


#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,b,c;
cout<<" enter the first number ";
cin>>a;
cout<<" enter the second number ";
cin>>b;
c=a*b;
cout<<" the result is "<<c;
getch();
}

AREA OF CIRCLE WHEN RADIUS IS DOUBLED

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
float r,a,A,ratio;
cout<<" enter radius ";
cin>>r;
a=3.14*r*r;
A=3.14*2*r*2*r;
cout<<" area of circle is:: "<<a<<"\n";
cout<<" area of circle when radius is doubled:: "<<A<<"\n";
ratio=a/A;
cout<<" The Ratio Of Areas Of the Two Circles is:: "<<ratio;
getch();
}

program to find table of any number


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

void main()
{
clrscr();
long int a,b,c,d,e,f,g,h,i,j;
cout<<" enter any number ";
cin>>a;
b=2*a;
c=3*a;
d=4*a;
e=5*a;
f=6*a;
g=7*a;
h=8*a;
i=9*a;
j=10*a;

cout<<"\n""the table(upto 10) is as follows :";
cout<<"\n"<<a;
cout<<"\n"<<b;
cout<<"\n"<<c;
cout<<"\n"<<d;
cout<<"\n"<<e;
cout<<"\n"<<f;
cout<<"\n"<<g;
cout<<"\n"<<h;
cout<<"\n"<<i;
cout<<"\n"<<j;

getch();
}

program of simple interest


#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
float p,r,t,s;
cout<<"enter the amount";
cin>>p;
cout<<"enter the rate";
cin>>r;
cout<<"enter the time";
cin>>t;
s=p*r*t/100;
cout<<"the simple intrest is"  <<s;
getch();
}

special program of set w


#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
void main()
{
clrscr();
cout<<setw(51)<<"*********************\n";
cout<<setw(51)<<"**                  *\n";
cout<<setw(51)<<"*********************\n";
cout<<setw(51)<<"**  #@#             *\n";
cout<<setw(51)<<"*********************\n";
cout<<setw(51)<<"**                  *\n";
cout<<setw(51)<<"*********************\n";
cout<<setw(41)<<"**\n";
cout<<setw(41)<<"**\n";
cout<<setw(41)<<"**\n";
cout<<setw(41)<<"**\n";
cout<<setw(41)<<"**\n";
cout<<setw(60)<<"  *   *   *   *   *   *   *   *   *   *   *  *\n";
cout<<setw(60)<<"  *   *   *   *   *   *   *   *   *   *   *  *\n";
cout<<setw(60)<<"  *   *   *   *   *   *   *   *   *   *   *  *\n";
getch();
}

program of set w


#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
void main()
{

clrscr();
cout<<setw(15)<<"***************";
cout<<setw(15)<<"\n""*             *";
cout<<setw(15)<<"\n""***************";
cout<<setw(15)<<"\n""*    ***      *";
cout<<setw(15)<<"\n""***************";
cout<<setw(15)<<"\n""*             *";
cout<<setw(15)<<"\n""***************";
cout<<"\n""*";
cout<<"\n""*";
cout<<"\n""*";
cout<<"\n""*";
cout<<"\n""*";

getch();
}

Friday, 23 September 2016

PROGRAMME FOR CONVERTING AN LOWERCASE CHARACTER INTO UPPER CASE

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
char a,b;
cout<<"enter the character";
cin>>a;
b=a-32;
cout<<"the uppercase is"<<b;
getch();
}

Wednesday, 21 September 2016

To chek the greatest number



Greatest of 3 numbers

#include < iostream.h >

void main()
{
int a,b,c;

cout<<"enter any three numbers:\n";
cin>>a>>b>>c;
if(a>b&&a>c)
cout<<"greatest number is:"<<a;
else if(b>c)
cout<<"greatest number is:"<<b;
else
cout<<"greatest number is:"<<c;
}

Program of if conditions



if condition

#include <iostream>
int main ()
{
int a = 10;
if( a > 5 )
{
cout<< " If Condition is satisfied ";
cout << " a is greater than 5 " <<a;
}
cout << "value of a is : " << a ;

return 0;
}

Friday, 16 September 2016

To check whether the no is even or odd



#include < iostream.h >

void main()
{
int n;

cout<<"Enter an integer\n";
cin>>n;
if ( n%2 == 0 )
cout<<"Even\n";
else
cout<<"Odd\n";

Getch ();

}

Area of triangle





#include < iostream.h >

void main()
{
int height, base;

cout<<"Enter height and base";
cin>>height>>base;
Area=height*base*0.5;

cout<<"Area if triangle is"<<area;

Area of triangle





#include < iostream.h >

void main()
{
int height, base;

cout<<"Enter height and base";
cin>>height>>base;
Area=height*base*0.5;

cout<<"Area if triangle is"<<area;

Adding of two numbers



#include < iostream.h >
int main()
{
int first, second, sum;

cout<<"Enter two integers to add\n";
cin>>first>>second;

sum = first + second ;

cout<<"Sum of entered numbers ="<<sum<<"\n";

return 0;
}