•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C# section within the Software Development category of DaniWeb, a massive community of 425,895 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 1,926 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C# advertiser: Programming Forums
Views: 366 | Replies: 2
![]() |
•
•
Join Date: Feb 2008
Location: Sivakasi, Tamilnadu, India
Posts: 458
Reputation:
Rep Power: 1
Solved Threads: 79
•
•
•
•
I give algorithm you try it in C#
HCF (GCD) Algorithm
GCD ( M, N ) {
If N > M then return GCD ( N, M )
else If N = 0 then return M
else return GCD ( N, MOD ( M, N) )
}
It is simple to covert it to C#
Also it is for two input
For three input
GCD ( M, N, O ){
return GCD ( M, GCD ( N, O ) )
}
Hie,
Thanks buddy, but i didnt really get the algo.
Heres the one from me:
=======
1 Input: num type variables M,N, HCF. (eg: M=100, N=125)
2 Find the smaller one from M,n. (eg: smaller: M)
3 Start a loop from M to M/2. (eg: i=m;i<=m/2;i++)
___1 Check whether i%m=0 & i%n==0.
___2 HCF = i; break;
Hope this can help you!
Regards,
PuneetKay
Last edited by puneetkay : Jul 11th, 2008 at 10:26 pm.
![]() |
•
•
•
•
•
•
•
•
DaniWeb C# Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- hcf and lcm (C++)
- Code for checking prime number or not (C++)
- Moniter Refresh/Flicker problem (Troubleshooting Dead Machines)
- HJT logfile that I'd appreciate some help with (Viruses, Spyware and other Nasties)
- Win98 will not detect PCI modem (Windows 9x / Me)
- question about dial up modem (PCI and Add-In Cards)
Other Threads in the C# Forum
- Previous Thread: how to put a clock in a form(windows application)
- Next Thread: OLEDB QUERY If user input has ' query fails.


Linear Mode