Here is an example for 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
a[i]=c;
else
{
printf("Invalid Entry");
return;
}
}
max=a[0];
for(i=0;i
max=a[i];
min=a[0];
for(i=0;i
{
if (min%i==0)
{
c=0;
for(j=0;j
c+=1;
}
if(c==n)
{
printf("The GCD of the nos: %d",i);
break;
}
}
getch();
}
At HelpWithAssignment.com we provide the best C Programming help. Our experts provide the best Online Tutoring, Assignment help and Homework help for College and University students.
For more details you visit our website at http://www.helpwithassignment.com/ and http://www.helpwithassignment.com/programing-assignment-help .
This is in continuation with our previous articles on C Programming.
No comments:
Post a Comment