C Codes
Beginners
C on Unix
Code Snippets
Data Structures
File Operations
Games Graphics
Gnu-Linux
Hardware
Mathematics
Miscellaneous
Small Programs
Sorting
C > Beginners Lab Assignments sample source codes
Finding LCM and GCD
Finding LCM and GCD #include
void main() { int a[20],n,i,j,c,max,min; unsigned long prod; clrscr(); printf("Enter the no. of entries: "); scanf("%d",&n); printf("Enter the entries: "); for(i=0;i
0) a[i]=c; else { printf("Invalid Entry"); return; } } max=a[0]; for(i=0;i
=max) max=a[i]; min=a[0]; for(i=0;i
0;i--) { if (min%i==0) { c=0; for(j=0;j
Privacy Policy
|
Link to Us
|
Links