Created
January 12, 2014 13:05
-
-
Save mukeshkdangi/8384354 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
long int fect(long int); | |
int main(){ | |
long int i,r,j,k=0; | |
long int n; | |
printf("\nEnter last number :"); | |
scanf("%d",&r); | |
for(i=1;i<=r;i++){ | |
for(k=0;k<=r-i-1;k++) | |
printf(" "); | |
for(j=1;j<=i;j++){ | |
n=fect(i)/(fect(j)*fect(i-j)); | |
printf("%ld ",n); | |
} | |
printf("\n"); | |
} | |
return 0; | |
} | |
long int fect(long int n){ | |
long int i,j,sum=1; | |
for(i=n;i>0;i--) | |
sum*=i; | |
return sum; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<cstring> | |
using namespace std; | |
class A{ | |
public : | |
int l,m; | |
int age; | |
char name[20]; | |
A(){ | |
age=0; | |
} | |
void geta(); | |
void printa(); | |
}; | |
class C:public A{ | |
public: | |
void getc(); | |
void printc(); | |
}; | |
class B:public C { | |
public : | |
void getb(); | |
void printb(); | |
}; | |
void A::geta(){ | |
cout<<"\nEnter name:"; | |
cin>>name; | |
cout<<"\nEnter age"; | |
cin>>age; | |
} | |
void A::printa() | |
{ | |
cout<<"name and age:"; | |
cout<<name<<age; | |
} | |
void C::getc(){ | |
cout<<"\nEnter name:"; | |
cin>>name; | |
cout<<"\nEnter age"; | |
cin>>age; | |
} | |
void C::printc() | |
{ | |
cout<<"name and age:"; | |
cout<<name<<age; | |
} | |
void B::getb(){ | |
cout<<"\nEnter name:"; | |
cin>>name; | |
cout<<"\nEnter age"; | |
cin>>age; | |
} | |
void B::printb() | |
{ | |
cout<<"name and age:"; | |
cout<<name<<age; | |
} | |
int main(){ | |
A obj; | |
A *ptr; | |
ptr=&obj; | |
//ptr->i=300; | |
ptr->geta(); | |
ptr->printa(); | |
C objc; | |
ptr=&objc; | |
((C *)ptr)->getc(); | |
(( C *)ptr)->printc(); | |
B objb; | |
ptr=&objb; | |
(( B*)ptr)->getb(); | |
(( B *)ptr)->printb(); | |
return 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
int main(){ | |
int i,a,b,n; | |
printf("\nEnter a and b:"); | |
scanf("%d%d",&a,&b); | |
for(i=2;i<a;i++){ | |
if(a%i==0 && b%i==0){ | |
n=i; | |
break; | |
}else | |
n=1; | |
} | |
printf("GCD is :%d",n); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment