Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Determine the greatest common divisor (GCD) of two integers, m & n. The algorithm for GCD might be defined as follows:

While m is greater than zero:

If n is greater than m, swap m and n.

Subtract n from m.

n is the GCD

Code in C

int gcd(int m, int n)

/* The precondition are following: m>0 & n>0. Let g = gcd(m,n). */

{

while( m > 0 )

{

if( n > m )

{ int t = m; m = n; n = t; } /* swap m & n*/

/* m >= n > 0 */

m - = n;

}

return n;

}

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M9534999

Have any Question?


Related Questions in Computer Engineering

Systems requirements and analysisyou have been hired to

Systems requirements and analysis You have been hired to lead a software project to design a Library Management System (LMS) for your local library at Jonesville. The library has been managed manually using written docum ...

C programmingneed help with a c program arrayrearrangec

***C PROGRAMMING*** Need help with a C program array_rearrange.c that rearranges an integer array. The array will be split into two sets of integers one by one. A new array will be created by append the first set to the ...

Scheduling algorithms are again becoming more important as

Scheduling algorithms are again becoming more important as we look at operating system that run on mobile devices. Are their scheduling algorithms different from those found on traditional interactive system? Compare and ...

Briefly explain the meaning of the t-test for regression

Briefly explain the meaning of the t-test for regression analysis. How can the "rule of two" be used to evaluate t-ratios?

Do research to identify three organizations that develop

Do research to identify three organizations that develop and operate e-commerce Web sites for their clients. Visit their Web sites and identify current job openings. What sort of responsibilities are associated with thes ...

Explain how amazon and walmart companies use information

Explain how Amazon and Walmart companies use Information and Communication Technologies (ICT) in their competitive strategies. Highlight the differences in their use of ICT.

Describe how to discover cookies on web browsers what is a

Describe how to discover cookies on web browsers. what is a reverse DNS lookup and can it be used when attacking the network.

30 of the cars in a dealer lot are red 21 are black and 22

30% of the cars in a dealer lot are red, 21% are black, and 22% are white. The remainder are some other unspecified color. Salespersons randomly shows three cars to three different customers. What is the probability the ...

What to do sort an array of single digit positive integers

What to do: Sort an array of single digit positive integers in LC-3 assembler - program will prompt user to enter a single digit integer. Non-negative values are accepted, with a zero entered to terminate input - the pro ...

You were recently hired as a database administrator for

You were recently hired as a database administrator for CSU-Global Campus. During grade reporting, CSG-Global cannot afford to have any downtime. You have been asked to develop a plan for monitoring SQL Server databases. ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As