473,662 Members | 2,693 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error GCD prob

4 New Member
sir ,first of all i want to say that i m a student of b.tech 1st sem.and this question doesn't comprise my projects or assignment.
i m unable to find out the reason of "garbage value returned by function GCD. .
if i m using a little different code, its working.the mere difference is that i hav interchanged the conditions and code inside the if-else statement.
If u trust me then plz help me out.
else its OK..
Feb 19 '08 #1
2 1065
gpraghuram
1,275 Recognized Expert Top Contributor
sir ,first of all i want to say that i m a student of b.tech 1st sem.and this question doesn't comprise my projects or assignment.
i m unable to find out the reason of "garbage value returned by function GCD. .
if i m using a little different code, its working.the mere difference is that i hav interchanged the conditions and code inside the if-else statement.
If u trust me then plz help me out.
else its OK..

If the function returns garbage then it means u are using some un-initialized variable.
or else you are not initializing the return variable properly inside the condition

Raghuram
Feb 19 '08 #2
vikasdev
4 New Member
If the function returns garbage then it means u are using some un-initialized variable.
or else you are not initializing the return variable properly inside the condition

Raghuram
sir..,
now i hav changed my code a little bit...previous code was:

if(r!=0)
hcf(r,div);
else

return(div);

where r is remainder finally after successive divisions.
now i hav changed it to:

sir..,
now i hav changed my code a little bit...now code is:

if(r!=0)
hcf(r,div);
else{
if(r==0) //..included afterwards..
return(div);}
now its working fine..
plz tell me why??
Feb 19 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
2711
by: DjDrakk | last post by:
I want to use headers to redirect the client if they didn't come from the correct page, but I have a problem with one page. If they leave a form field empty, they are redirected back to the page they came from with an error number and a 6 digit 1d number in the location bar which defines what field was left empty( order.php?prob=2&id=000001) My only problem is that when they repost, the $_SERVER contains the get variables and doesn't...
1
4769
by: Bill S. | last post by:
Hi, I a stored procedure that inserts a record into a table as below. The insert works OK, but if the insert violates a unique indewx constraint on one of the columns, the proc terminates immediately, and does NOT execute the 'if @@ERROR <> 0' statement.
0
867
by: _Christopher\(M2M\) | last post by:
Why is VS 2003 C++ moving my events from my programme, it run OK. :-) But soon as I change to the Design form some of the events have been deleted! The only thing I can find that sound like my prob. is the link: http://msdn.microsoft.com/vstudio/downloads/updates/datalossifx.aspx But that no good!! ;-(
9
5553
by: M.N.A.Smadi | last post by:
HI; I am having the following error. I am using someone else's code and all they are doing is pass an argv to a function then def execute_action(manager, argv): method_name = argv.pop(0).lower() and am getting this strange error.
3
1109
by: Mythran | last post by:
We have a web control. (Please note, all our libraries and controls are given a strong name). When we place the web control on a web page, it works fine. We are using a project reference to it in our sample application. Sometimes immediately following a build/rebuild, it displays the design time error html. We have tracked the problem down to the first line in GetErrorDesignTimeHtml() (I believe that's the method's name, I just woke...
1
5633
by: brittogladez | last post by:
Hi Friends, Please carefully go through my prob which is listed below and give me a solution. Server Error in '/<Appname>' Application. -------------------------------------------------------------------------------- Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
0
1400
Savage
by: Savage | last post by:
I'm making for fun a simple program which format a input file.Input file sustain of person name,lastname and date of birth.Output file si supposed to be forammted as following: NAME LASTNAME DATE OF BIRTH And i finished it but there is little prob: it don't output date of birth! I thinkt about the prob and can't figure out why is that happening. To output data i used function: void output(void),i have...
3
4106
by: MLH | last post by:
I got this error twice in 72-hours. Each time, a different global procedure was not found. One was being used in an SQL statement and the other in a Set stmt in DAO routine. Both FNs, of course, are defined and have been for 1.5 years. First time it happened, I closed and restarted app. Prob went away. Second time, I rebooted
15
2153
by: cypriot | last post by:
Hi. I want to insert data to ms access from an application I developed in java but I think I have a prob with data types. This is my code. savebutton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try{
6
14719
by: samsneelam | last post by:
Hi.. This is samuel, while doing a program, i encountered this problem.. Let me give you clarity regarding my prob.. I am having two files .. one is mpcplib.h it contains the follwing declerations.... #include <queue> #include <vector> #include <string> class database { queue<delayTP> delayThrouput;
0
8435
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8857
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8768
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8547
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8633
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7368
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6186
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4348
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1999
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.