1. Write a c program to reverse any number.
2. Write a c program to find out sum of digit of given number.
2. Write a c program to find out sum of digit of given number.
10. Write a c program to find out NCR factor of given number.
11. How to convert string to int without using library functions in c
12. Program in c to print 1 to 100 without using loop
13. C program for swapping of two numbers
14. Program to find largest of n numbers in c
15. Split number into digits in c programming
16. C program to count number of digits in a number
11. How to convert string to int without using library functions in c
12. Program in c to print 1 to 100 without using loop
13. C program for swapping of two numbers
14. Program to find largest of n numbers in c
15. Split number into digits in c programming
16. C program to count number of digits in a number
9 comments:
nahi chalta hai
yas its running :).....u hv 2 define the function fact first
ritly said just define the function and it will work.,.. just apply your basic skills..u cannot get the rite code on net... n i think its bettter coz atleast u can act upon the program to correct it,thereby learning the program in a better weay...
#include
#include
viodmain(0
{
int n,r,i,f1,f2,f3,ncr;
clrscr();
printf("input n and r values");
scanf("%d%d",&n,&r);
f1=1;f2=1;f3=1;
for(i=1;i<=n;i++) f1*=i;
for(i=1;i<=r;i++) f2*=i;
for(i=1;i<=n-r;i++) f3*=i;
ncr=f1/(f2*f3);
printf("\n ncr=%d",ncr);
getch();
}
#include
void main()
{
int n,r,i,f=1,a,b,j,g=1,c,k,h=1,d,factorial;
printf("enter the values of n and r\n");
scanf("%d%d",&n,&r);
for(i=1;i<=n;i++)
{
f=f*i;
a=f;
}
b=n-r;
for(j=1;j<=b;j++)
{
g=g*j;
c=g;
}
for(k=1;k<=r;k++)
{
h=h*k;
d=h;
}
factorial=(a/(c*d));
printf("the ncr are factorial of a given no is %d",factorial);
}
#include
#include
int ncr(int n,int r)
{
int ncr=1;
if(n==0!!n==r)
{
ncr=ncr*0;
}
else if(r==0)
{
ncr=ncr*n;
}
else
{
ncr=ncr*ncr(n-1,r-1);
}
return(ncr);
}
void main()
{
printf("%d",ncr(2,1));
}
Please Add Prototype of Fact function After The Headers.Because In Some Compilers it shows Error.
I think This is nice Way To Prevent the Copy Paste of codes during assignments of several Courses.and Dummes never find why this not working :D
I like it.
I think This is nice Way To Prevent the Copy Paste of codes during assignments of several Courses.and Dummies never find why this not working :D
I like it.
Post a Comment