->factorial 

#include<iostream>
using namespace std;
long factorial(int x)
{
 int i,f=1;
 for(i=1; i<=x; i++) 
 {
  f=f*i;
 }
 return f;
}
int main()
{
 int n;
 cout<<"enter the number";
 cin>>n;
 if(n<0)
 {
  cout<<"factorial is not defined for negetive no ";
 }
 else
 {
 cout<<"factorial="<<factorial(n);
}
}

->find length string?

#include<iostream>
using namespace std;
int main()
{
 int length=0,i;
 char s[20];
 cout<<"enter the string ";
 cin.getline(s, 20);
 for (i=0; s[i]!='\0'; i++)
 {
  length=length+1;
 }
 cout<<"the length of string "<<length;
}

-> quadratic eqn?     
#include<iostream>  
#include<cmath>
using namespace std;
int main ()
{
 float a,b,c,r1,r2,d;
 cout<<"enter the 3 coeficient: ";
 cin>>a>>b>>c;
 d=b*b-4*a*c;
 if(d>0)
 {
  r1=(-b+sqrt(d))/(2*a);
  r2=(-b-sqrt(d))/(2*a);
  cout<<"in root 1= "<<r1<<'\t'
                <<"in root 2= "<<r2;
 }
 else if(d==0)
 {
  r1=r2=-b/(2*a);
  cout<<"the root R equal";
  cout<<"root 1= "<<r1<<'\t'
                <<"root 2= "<<r2;
 }
 else
 cout<<"the root R imaginary";
}

->sum of digit of int no.?

#include<iostream>
using namespace std;
int main()
{
 int num,rem,sum=0;
 cout<<"enter a number ";
 cin>>num;
 while (num>0)
 {
  rem=num%10;
  sum=sum+rem;
  num=num/10;
 }
 cout<<"sum of digit "<<sum;
}

->sum of squar of no?

#include<iostream>
using namespace std;
int main()
{
 int length=0,i;
 char s[20];
 cout<<"enter the string ";
 cin.getline(s, 20);
 4 (i=0; s[i]!='\0'; i++)
 {
  length=length+1;
 }
 cout<<"the length of string "<<length;
}

->n terms of fabno series

#include<iostream>
using namespace std;
int main()
{
 int 1st,2nd,current,i,limit;
 cout<<"enter the limit: ";
 cin>>limit;
 1st=0;
 2nd=1;
 current=1st;
 for(i=0; i<limit; i++)
 {
  cout<<'\t'<<current;
  1st=2nd;
  2nd=current;
  current=1st+2nd;
 }
}

->prime no below 100

#include<iostream>
using namespace std;
int main()
{
 int i,flag,j;
 for(i=2; i<=100; i++)
 {
  flag=0;
  for(j=2; j<=i/2; j++)
  {
   if(i%j==0)
   {
    flag=1;
    break;
   }
  }
  if(flag==0)
  cout<<'\t'<<i;
 }
}

->salary of employ

#include<iostream>
using namespace std;
struct employee
{
 int emp_code;
 char emp_name [20];
 int basic_pay,da,hra,pf;
};
int main()
{
 employee emp;
 cout<<"enter employe code: ";
 cin>>emp.emp_code;
 cout<<"\nenter emp name: ";
 cin>>emp.emp_name;
 cout<<"\nenter basic pay: ";
 cin>>emp.basic_pay;
 cout<<"\nenter DA: ";
 cin>>emp.da;
 cout<<"\nenter HRA: ";
 cin>>emp.hra;
 cout<<"\nenter PF: ";
 cin>>emp.pf;
 int total=emp.basic_pay+emp.da+emp.hra-emp.pf;
 cout<<"\n net salery: "<<total;

->decimal 2 binary?

#include<iostream>
using namespace std;
int main()
{
 int n;
 void binary(int);
 cout<<"enter the decimal number: ";
 cin>>n;
 cout<<"binary eqvalent is: ";binary (n);
}
void binary (int x)
{
 if(x>1)
 binary (x/2);
 cout<<x%2;
}

->palindrom?

#include<iostream>
using namespace std;
int main()
{
 int n,rev=0,rem,copy;
 cout<<"enter the number: ";
 cin>>n;
 copy=n;
 while(n>0)
 {
  rem=n%10;
  rev=rev*10+rem;
  n=n/10;
 }
 if(copy==rev)
 cout<<"the number is palindrome ";
 else
 cout<<"the number is not palindrome ";
}