-->

program to count number of digits present in a number.

//program to count number of digits present in a number.
#include<stdio.h>
#include<conio.h>
void main()
{
   int n,rem,count=0;
   printf("enter a number for 'n'\n");
  scanf("%d",&n);
  while(n!=0)
    {
        rem=n%10;
       count++;
        n=n/10;    
   }
printf("total digits =%d",count);
getch();
}
--------------------------------------------------------------------------------------------------
logics in mind:-
>first we enter a number(for 'n').
->If we have number 123 then it has 3 digits and they are 3, 2 and 1 or 1,2 and 3. It means, first we have to get 3 then 2 and then 1 and we have to count them.        
                  ->For this, 
                 ->we have to divide by 10 to get last digit as remainder 
                 ->we also use 'count' to start counting  digits.
                -> to get second digit, we get first 12 and for this , we use 123/10.It is done to get integer                           part  only.
->We repeat this until the value reaches 0. We use loop for this as shown above in the code.     
->at last we display total number of digits stored in variable 'count'.   

program to get sum of given series with................nth terms.

//program to get sum of x+ x2/2+x3/3+x4/4+.............................nth terms.
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
  float i,n,x,m=1,sum=0;
   printf("enter  positive number for 'n'\n");
  scanf("%f",&n);
printf("enter value for 'x'\n");
scanf("%f",&x);
  for(i=1;i<=n;i++)
    {               
          sum=sum+(pow(x,m)/i);
           m=m+1;
     }
  printf("the sum=%f",sum);
getch();
}
-------------------------------------------------------------------------------------------------------------------------------------------------
logics in mind:
->enter a number for range for which you want to get sum, say 'n'.
->let a variable 'sum' with initial value '0'
->here we also need value for 'x' so let's input that
->we get sum using formula sum=sum+(pow(x,m)/i); because in terms x+ x2/2+x3/3+x4/4+..............  ,
    ->we have two components namely numerator and denominator. Let's look at numerator;they are
           x1,x2,x3,x4.....it can be formulated as pow(x,m) .  .here the power (m) goes on increasing.
   ->similarly for denominator, it is simply 1,2,3,4.... so it can be used from loop (variable i).
->we find sum inside loop
->at last we display the final sum.
   here 'pow' means finding power. it exists inside math.h

program to get sum of 1+3/4+7/16+15/64..............................nth terms.

//program to get sum of 1+3/4+7/16+15/64..............................nth terms.
#include<stdio.h>
#include<conio.h>
void main()
{
   float i,n,k=2,sum=0,m=0;
   printf("enter  positive number for 'n'\n");
  scanf("%f",&n);
  for(i=1;i<=n;i++)
    {               
          sum=sum+(pow(k,i)-1)/(pow(k,m));
          m=m+2;    
     }
  printf("the sum=%f",sum);
getch();
}
-------------------------------------------------------------------------------------------------------------------------------------------------
logics in mind:
->enter a number for range for which you want to get sum, say 'n'.
->let a variable 'sum' with initial value '0'
->we get sum using formula sum=sum+(pow(k,i)-1)/(pow(k,m)) because in terms 1+3/4+7/16+15/64...    ,
    ->we have two components namely numerator and denominator. Let's look at numerator;they are
           1,3,7,16.....it can be formulated as pow(k,i)-1 that is    21-1  .here the power goes on increasing
   ->similarly for denominator, it has power of 2 i.e.
                 20,22,24. we can see here that power is increasing by 2.
                for this we have,pow(k,m) then m=m+2
->we find sum inside loop
->at last we display the final sum.

program to get sum of given series with ..................nth terms.

//program to get sum of 12x1+23x3+34x5+..............................nth terms.
#include<stdio.h>
#include<conio.h>
void main()
{
   float i,n,k=2,m=1sum=0;
   printf("enter  positive number for 'n'\n");
  scanf("%f",&n);
  for(i=1;i<=n;i++)
    {               
          sum=sum+(pow(i,k)*m);
           k=k+1;
           m=m+2;
     }
  printf("the sum=%f",sum);
getch();
}
-------------------------------------------------------------------------------------------------------------------------------------------------
logics in mind:
->enter a number for range for which you want to get sum, say 'n'.
->let a variable 'sum' with initial value '0'
->we get sum using formula sum=sum+(pow(i,k)*m) because in terms 12x1+23x3+34x5+..     ,
        the first value is i(1),second is k(2) and third is m(1).the values in second and all other terms are changing 
   i----by 1
   k by 1
  m by 2     
  so
        we put these values  inside loop.
->at last we display final sum.

program to get sum of (2x3)/5+(4x5)/7+(6x7)/9+,.... to nth term.

//program to get sum of (2x3)/5+(4x5)/7+(6x7)/9+,....           to nth term.
#include<stdio.h>
#include<conio.h>
void main()
{
   float i,n,k=2,m=3,p=5,sum=0;
      printf("enter  positive number for 'n'\n");
  scanf("%f",&n);
  for(i=1;i<=n;i++)
    {               
          sum=sum+(k*m)/p;
           k=k+2;
           m=m+2;
          p=p+2;        }
  printf("the sum=%f",sum);
getch();
}
-------------------------------------------------------------------------------------------------------------------------------------------------
logics in mind:
->enter a number for range for which you want to get sum, say 'n'.
->let a variable 'sum' with initial value '0'
->we get sum using formula sum=sum+(k*m)/p because in terms (2x3)/5+(4x5)/7+(6x7)/9+,...     ,
        the first value is k(2),second is m(3) and third is p(5).the values in second and all other terms are changing 
       by +2 so
        we put
          k=k+2;
           m=m+2;
          p=p+2; inside loop.
->at last we display final sum.