Tuesday, July 14, 2009

Write a program that will compute for the formula of the following using FUNCTIONS in turbo c.?

1. permutation: nPr=n!/(n-r)!


2. combination: nCr=n!/r!(n-r)!


3.permutaion with repetition: n!/(n1!n2!n3!)


4.point slope: y-y1=m(x-x1)


5.slope-intercept: y=mx+b


6.two-point: y-y1=((y2-y1)/(x2-x1))*(x-x1)





"this is an example program using FUNCTIONS:"





#include%26lt;stdio.h%26gt;


int a,b;


void sum(x,y)


int x,y;


{


int total;


total=x+y;


printf("the sum is %d",total);


}


void diff(c,d)


int c,d;


{


int diff;


diff=c-d;


}


printf("the diff is %d",diff);





main()


{


printf("input 2nos");


scanf("%d %d",%26amp;a,%26amp;b);


sum(a,b);


diff(a,b);


getch;





hope someone will help me with my project in programming..tnx in advance,:)

Write a program that will compute for the formula of the following using FUNCTIONS in turbo c.?
Well this not done..don't cheat on your Project work...


Let me point you in right direction..


1.Think loops...


2. n and r are two variables which you accept as input from the user.


3. n! is nothing but n*n-1*...1, Iterate to calculate the values for Numerator and denominator separately (to keep it easy) then divide ...and there's ur answer print it on Stdout or arite to a file..whatever is the requirement..


hope this helps


No comments:

Post a Comment