GoogelAddUnit1

Thursday, 10 March 2011

C Program on implementation of for loop.


/*    program for   ex   */                                          
#include<stdio.h>
#include<conio.h>
void main()
{
  float  f,sum,x;
  int i,n,p,t;
  printf("\n enter  x, n");
  scanf("%d%d",&x,&n);
  t=1;
  sum=1;
  for(i=1;i<=n;i++)
    {
      p=i;
      t=t*(x/p);
      sum=sum+t;
    }
    printf("%d",sum);
    getch();
}

No comments:

Post a Comment