473,508 Members | 2,040 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 1056
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
2701
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...
1
4764
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...
0
862
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...
9
5547
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 =...
3
1093
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...
1
5625
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....
0
1393
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 ...
3
4102
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...
15
2128
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()...
6
14707
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...
0
7125
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7328
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,...
1
7049
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...
0
7499
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...
0
5631
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,...
0
4709
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3199
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1561
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
422
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.