C++ tutorial, C++ programs, C++ Exercises, C++ Example Programs

Friday, December 6, 2013

Program For Loop Display Odd 1 to 10


/*
Write a C++ Program to display Odd between 1 to 10 numbers by FOR Loop

For Free C++ Programming Techniques (Example Programs), visit
Www.EasyCppProgramming.Blogspot.Com

and For Good Notes
Visit   Www.ForFreeEducation.Blogspot.Com

*/
Program For Loop Display Odd 1 to 10, C Plus Plus Program Display Odd Numbers between 1 to 10
#include<iostream.h>

#include<conio.h>

void main()
{

  clrscr();

  int counter;

  cout<<"\n\n ----------- Results ------------";

  cout<<"\n\n Display Odd Numbers between \n 1 to 10 by For Loop ";

  for (counter = 1; counter <= 10; counter += 2)
           cout<<"\n"<<counter;

  getch();

}
Share:

Program For Loop Display Even 1 to 10

Program To Display Even Numbers between 1 to 10, Display Even 1 to 10 by FOR Loop 

/*
Write a C++ Program to display Even between 1 to 10 numbers by FOR Loop

For Free C++ Programming Techniques (Example Programs), visit
Www.EasyCppProgramming.Blogspot.Com

and For Good Notes
Visit   Www.ForFreeEducation.Blogspot.Com

*/
#include<iostream.h>

#include<conio.h>

void main()
{

  clrscr();

  int counter;

  cout<<"\n\n ----------- Results ------------";

  cout<<"\n\n Display Even Numbers between \n 1 to 10 by For Loop ";

  for (counter = 2; counter <= 10; counter += 2)
           cout<<"\n"<<counter;

  getch();

}
Share:

Program For Loop Display 10 To 1 Numbers

C Plus Plus Program To display numbers from 10 down to 1, Program For Loop Display 10 To 1 Numbers

/*
Write a C++ Program to display 10 down to 1 numbers by FOR Loop

For Free C++ Programming Techniques (Example Programs), visit
Www.EasyCppProgramming.Blogspot.Com

and For Good Notes
Visit   Www.ForFreeEducation.Blogspot.Com

*/
#include<iostream.h>

#include<conio.h>

void main()
{

  clrscr();

  int counter;

  cout<<"\n\n ----------- Results ------------";

  cout<<"\n\n Display Numbers from 1 to 10 by For Loop ";

  for (counter = 10; counter >= 1; counter--)
           cout<<"\n"<<counter;

  getch();

}
Share:

Program For Loop Display 1 to 10

Program For Loop Display 1 to 10, Display 1 to 10 numbers by for loop

/*
Write a C++ Program to display 1 to 10 numbers by FOR Loop

For Free C++ Programming Techniques (Example Programs), visit
Www.EasyCppProgramming.Blogspot.Com

and For Good Notes
Visit   Www.ForFreeEducation.Blogspot.Com

*/
#include<iostream.h>

#include<conio.h>

void main()
{

  clrscr();

  int counter;

  cout<<"\n\n ----------- Results ------------";

  cout<<"\n\n Display Numbers from 1 to 10 by For Loop ";

  for (counter = 1; counter <= 10; counter++)
           cout<<"\n"<<counter;
 
  getch();

}
Share:

Monday, December 2, 2013

Program To Find Circumference of Circle

/*
Write a C++ Program to input a float number(radius of circle) and
calculate / display the Circumference of the circle.

For Free C++ Programming Techniques (Example Programs), visit
Www.EasyCppProgramming.Blogspot.Com

and For Good Notes
Visit   Www.ForFreeEducation.Blogspot.Com

*/


Program To Find Circumference of Circle, How To Find Circumference of Circle While Area is given
#include<iostream.h>

#include<conio.h>

void main()
{
                                  
  clrscr();

  const float PI = 3.14;

  float radius, circumference;

  cout<<"\n Enter Radius of the Circle (to find its Circumference): ";

  cin>>radius;

  // required formula
  // Circumference of Circle = 2 x PI x R

  circumference = 2 * PI * radius;

  cout<<"\n\n ----------- Results ------------";

  cout<<"\n\n Circumference of Circle = "<<circumference;

  getch();

}
Share:

Program To Find Area of Circle


/*
Write a C++ Program to input a float number(radius of circle) and
calculate / display the Area of the circle.

For Free C++ Programming Techniques (Example Programs), visit
Www.EasyCppProgramming.Blogspot.Com

and For Good Notes
Visit   Www.ForFreeEducation.Blogspot.Com

*/

Find Area of Circle, Input radius and find area of circle, program area of circle

#include<iostream.h>

#include<conio.h>

void main()
{

  clrscr();

  const float PI = 3.14;

  float radius, area;

  cout<<"\n Enter Radius of the Circle (to find its area): ";

  cin>>radius;

  // required formula
  // Area of Circle = PI x R(Squared)

  area = PI * radius * radius;

  cout<<"\n\n ----------- Results ------------";

  cout<<"\n\n Area of Circle = "<<area;

  getch();

}
Share:

Sunday, December 1, 2013

Program Find Quotient and Remainder of Division


/*
Program to input a number(dividend) and second number(divisor), and display the Qutient
and remainder of the division.
For Free C++ Programming Techniques (Example Programs), visit
Www.EasyCppProgramming.Blogspot.Com

and For Good Notes
Visit   Www.ForFreeEducation.Blogspot.Com

*/

Free C++ Program to find qutient and Remainder of Division,Program Find Out Quotient and Remainder, Program Division, Program Dividend Divisor Quotient Remainder

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

  int dividend, divisor, q, r;

  cout<<"\n Enter a number (Devidend) =";

  cin>>dividend;

  cout<<"\n Enter a number (divisor) =";

  cin>>divisor;

  q = dividend / divisor;

  r = dividend % divisor;

  cout<<"\n ----------- Results ---------------";

  cout<<"\n Dividend = "<<dividend;

  cout<<"\n divisor = "<<divisor;

  cout<<"\n Quotient = "<<q;

  cout<<"\n Remainder = "<<r;

  getch();

}
Share:

Thursday, October 31, 2013

Program Find Out Square Cube of Number




/*

Program to input a number, then display its square and cube.
(c) Www.EasyCppProgramming.Blogspot.Com
*/


#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
     int num, square, cube;

     clrscr();

     cout<<"Enter a number=";
     cin>>num;

     cout<<"\n Method 1: By Multiplication operator *\n";
    
     square = num * num;
     cube   = num * num * num;
     cout<<"\n The number="<<num<<"    Square="<<square<<"   Cube="<<cube;


     cout<<"\n\n Method 2: By pow function of math.h \n";
    
     square = pow(num,2);
     cube   = pow(num,3);
     cout<<"\n The number="<<num<<"    Square="<<square<<"   Cube="<<cube;

     getch();

     }

Output of the program execution:


Share:

Tuesday, October 29, 2013

Program Exchange Values Without Third Variable


#include<iostream.h>
#include<conio.h>
void main()
{
     int v1, v2;

     cout<<"Enter value of first variable:";
     cin>>v1;
  
     cout<<"Enter value of second variable:";
     cin>>v2;

     cout<<"The values before swapping are: \n Varible 1="<<v1<<" Variable 2="<<v2;
     v2 = v1+v2;
     v1 = v2-v1;
     v2 = v2-v1;

     cout<<"\n The values after swapping are: \n Varible 1="<<v1<<" Variable 2="<<v2;  
     
      getch();

     }
Share:

Friday, October 25, 2013

Program to Swap Values of Two Variables




#include<iostream.h>
#include<conio.h>
void main()
{
     int v1, v2, temp;

     cout<<"Enter value of first variable:";
     cin>>v1;
   
     cout<<"Enter value of second variable:";
     cin>>v2;

     cout<<"The values before swapping are: \n Varible 1="<<v1<<" Variable 2="<<v2;
     temp = v1;
     v1 = v2;
     v2 = temp;

     cout<<"\n The values after swapping are: \n Varible 1="<<v1<<" Variable 2="<<v2;   
      
      getch();

     }
   
Share:

EasyCPPprogramming.blogspotcom

Labels