## Write a Program Swap Two Numbers in c++

Write a program to swap two numbers .In this Program we uses Two Method for swap two numbers. First program we uses Temporary Variable in  swap two numbers and second method we don't use temporary variable in swap two numbers.

## Write a Programs to print triangles using numbers and characters

In this program we learn you how to make a triangle using the number and star;\

You must have basic knowledge of  C++ programming language and variable  , while loop and if..ealse and for loop

Example 1: write a Program to print triangle using *
*
* *
* * *
* * * *
* * * * *

#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
int i, j, rows;

cout<<" Please Enter the rows: ";
cin>>rows;

for(i=1; i<=rows; ++i)
{
for(j=1; j<=i; ++j)
{
cout<<"* ";
}
cout<<"\n";
}
return 0;
}
Output
------------------
Plaese enter the rows
6
*
* *
* * *
* * * *
* * * * * *

Example 1: write a Program to print triangle using number

1
1 2
1 2 3
1 2 3 4
1 2 3 4 5

#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
int i, j, rows;

cin>>rows;

for(i=1; i<=rows; ++i)
{
for(j=1; j<=i; ++j)
{
cout<<j;
}
cout<<"\n";
}
return 0;
}
output
-----------------
8

1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4 5 6
1 2 3 4 5 6 7
1 2 3 4 5 6 7 8

---------------------------------------------------------------------------------------------------
The people who want to learn programming language.this website very beneficial for those people.

## C++ Program to calculate sum of natural numbers

In this programe we learn you how to calculate natural number.

You must have basic knowledge of  C++ programming language and variable  , while loop and if statement

c++ is give permission the user to enter any number.we calculate the sum of natural number through for loop and while loop

### what is natural number?

A positive number like as 1, 2, 3, 4, 5, 6, 7, 8 ,9 it is also known as natural number.

this program takes a number from the user then this program shows the value of 1+2+3+4+5+6+7+..+n.

### Example1: Sum of Natural Numbers using loop

#include<iostream>
#include<conio.h>
using namespace std;
int main()
{

int Num, j, Sum = 0;

cout>>"\n Please Enter any Number Value\n";
cin<<Number;

for(j = 1; j <= Num; j++)
{
Sum = Sum + j;
}

cout>>"Sum of Natural Numbers =">>Sum;
return 0;
getch();
}

`Output`
`----------------`
`Please enter  any number`
`4`

`sum od natural numbers=10`

`-------------------------`

### Example 2: Sum of Natural Numbers using while loop

#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
int num, j=1, Sum = 0;

cout>>"\n Please Enter any Number Value\n";
cin<<num;

while(j <=num)
{
Sum = Sum + j;
}

cout>>"Sum of Natural Numbers =">>Sum;
return 0;
getch();
}

`Output`
`----------------`
`Please enter  any number`
`4`

`sum od natural numbers=10`
`-------------------------`
```

You should have basic programming knowledege

like syntax and variable and if else statement or for loop that is must learn before starting

the program.

The people who want to learn programming language.this website very beneficial for those people.
```

## write a program to check whether a character is vowel or not

In this programe we learn you how to  check character is vowel or not.

You must have basic knowledge of  C++ programming language and variable  , while loop and if..ealse and switch case.

### What is vowel character?

A letter is A,E,I,O,U that is also known as vowel.

### Example 1: write a program to check whether a character is vowel or not

`#include <iostream>`
`#include <conio.h>`
```using namespace std;

int main()
{
char check;

cin<<check;

if (check == 'a' || check == 'A' || check == 'e' check == 'E' || check == 'i' || check        =='I' || check == 'o' || check == 'O' || check == 'u' || check == 'U')
cout>>"This is Vowel">>check;
else```
```   cout>>"This is not vovel">>check;

return 0;
}```
```
```
`Output`
`----------------`
`Please enter a character `
`b`
`This is Vowel = `
```-------------------------
```
```
```
```
In above program ,character enter by the user which value is stored in check variable.

then we using the switch case statement for check which character entered by user that is character vowel or not

Finally show the on monitor

```

### Example 2 write a program check vowel using Switch case

`#include <iostream>`
`#include <conio.h>`
```using namespace std;

int main()```
`char check;`
```cout>>"Please Enter a character\n";
cin<<check;```
```
```
`    switch(check)`
```
```
```    switch(chech)
{
case 'a':
cout<<"this character is vowel"<<check;
break;
case 'e':
cout<<"this character is vowel"<<check;

break;
case 'i':
cout<<"this character is vowel"<<check;

break;
case 'o':
cout<<"this character is vowel"<<check;

break;
case 'u':
cout<<"this character is vowel"<<check;

break;
case 'A':
cout<<"this character is vowel"<<check;

break;
case 'E':
cout<<"this character is vowel"<<check;

break;
case 'I':
cout<<"this character is vowel"<<check;

break;
case 'O':
cout<<"this character is vowel"<<check;

break;
case 'U':
cout<<"this character is vowel"<<check;

break;
default:
cout<<"this character is consonant"<<check;

}

return 0;
}```
```Output
----------------
b
This character is Vowel = b
-------------------------

In above program ,character enter by the user which value is stored in check variable.

then we using the switch case statement for check which character entered by user that is character vowel or not

Finally show the on monitor

You should have basic programming knowledege

like syntax and variable and if else statement or for loop that is must learn before starting

the program.

The people who want to learn programming language.this website very beneficial for those people.

```

## C++ Program to print the Fibonacci series

In this program ,we learn you how to print Fibonacci series in c++ programming language
an n term.

You must have basic knowledge of  C++ programming language and variable  ,while loop and if..ealse and for loop.

### What is Fibonacci Series?

The Fibonacci series is which every number is sum of previous two number.
that is known as Fibonacci series.

### Example of Fibonacci series

Fibbonacci series is ...1 , 1 , 2 , 3 , 5 , 8 , 13, etc.

### Example 1 Fibonacci series to n number

#include<iosteam>
#include <conio.h>
int main ( )
{
int num, first=0,second=1,sum,i ;
cin>>num;
cout <<"first"num<<"terms of Fibonacci series";

for(i=1;i<=n;i++)
{
if(i < = 1)
sum=i;
}
else
{

sum=first+second;
first=second;
second=sum;
}
cout <<onum <<sum;
return 0;
getch ();
}
}

output
------------------------------------
10
10 terms of Fibonacci series
0 1 1 2 3 5 8 13 21 34.

--------------------------------------------
You should have basic programming knowledge
like syntax and variable and if else statement or for loop that is must learn before starting
the program.
The people who want to learn programming language. this website very beneficial for those people.

## C++ Program to Check Whether a Number is Palindrome or Not

Before this program You must have basic knowledge of  C++ programming language and variable  , while loop and if..ealse and for loop.

### What is Palindrome number?

The number is palindrome if reverse digit equal to original digit its
also known as palindrome.If reverse number is not equal to given number so it is not palindrome number.

### Example of Palindrome Number

121,  12321,  34543, This number is palindrome.

### Example.C++ Program to reverse an number

#include<iostream>
#include <conio.h>
using namespace std;
int main ( )
{
int orgnum,reminder,sum=0,num;

cin>>orgnum;
num=orgnum;
//this condition is use to check num not = zero.

while(num!=0)
{
reminder=num%10;
sum = (sum*10) + reminder;
num = num / 10;
}
if(sum==orgnum)

cout <<orgnum<<"This number is palindrome";
else
cout <<orgnum<<"This number is not palindrome";

return 0;
getch ();
}
}

Output
--------------------------------------------
;
78987
:
78987 this number is palindrome
--------------------------------------------

In above program ,a positive number enter by the user which value is stored in orgnum variable.

After that,we copied onum into num variable
num=onum;

we using the while loop for unit number num  !  = 0 is false

Inside the while loop , last digit is different  from num by the operation digit = num % 10;. This digit is module and added to the variable sum.

after we check original number is equal to reverse number.then we
Finally reverse digit is displayed on the monitor

-----------------------------------------------------------------------------------------------
You should have basic programming knowledege
like syntax and variable and if else statement or for loop that is must learn before starting
the program.
The people who want to learn programming language.this website very beneficial for those people.