473,666 Members | 2,096 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Finding difference

36 New Member
Hi
i just need to find the difference between to numbers .
if i subtract i am getting the minus symbol,i just want the difference of two numbers .

your help will be appreciated

thanking you in advance
Apr 18 '08 #1
1 5699
nithinpes
410 Recognized Expert Contributor
Hi
i just need to find the difference between to numbers .
if i subtract i am getting the minus symbol,i just want the difference of two numbers .

your help will be appreciated

thanking you in advance

All you need to do is to use abs() function to get the absolute value.

For ex:
Expand|Select|Wrap|Line Numbers
  1. $a = 5;
  2. $b = 12;
  3. $c= abs($a-$b);
  4. print "Difference: $c \n";  ## will print Difference: 7
  5.  
  6.  
Apr 18 '08 #2

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

Similar topics

11
3750
by: Wolfgang Kaml | last post by:
Hello All, I have been working on this for almost a week now and I haven't anything up my sleeves anymore that I could test in addition or change.... Since I am not sure, if this is a Windows 2003 Server or ADO or ODBC issue, I am posting this on all of the three newsgroups. That's the setup: Windows 2003 Server with IIS and ASP.NET actiavted Access 2002 mdb file (and yes, proper rights are set on TMP paths and path,
22
2004
by: Annajiat | last post by:
Hi, a) int grid; Which of the following is faster? 1. memset(grid,0,1010*1010); 2. memset(grid,0,sizeof(grid)); b) Is there any faster alternative to initializing memory? c) What is the difference between comp.lang.c and alt.comp.lang.c ?
15
46461
by: cwsullivan | last post by:
Hi gang, I have a grid full of particles in my program, and I want to find an angle between two particles. I'm having trouble because it seems like the answer depends on whether or not the target particle is above or below, in front or behind the refernce particle. If I have a reference particle at (10,10), and another particle at (20,20), i'm currently finding the angle by: angle = atan((10-20)/(10-20)) = 45 degrees. When I draw this...
4
2391
by: lakshmananl | last post by:
hi, i am doing a report generation work in which i take the count of two columns. and i need to calculate the difference of the counted value as a new column. for example in SQL we use <B>difference(count(a.column1),count(a.column2)) as alias <B> what will be the equivalent statement in DB2
5
74213
by: prileep | last post by:
Hi, I want to find the the exact difference between two dates in seconds through MySQL query. Version: 4.1 Platform: Linux Source code: >select datediff('2007-01-09 10:24:46','2007-01-09 10:23:46') The datediff() function has only two datetime parameters and returns the difference in days.Instead if i want the value to be returned in seconds,what is the possible way??
1
7857
by: indiarocks | last post by:
This is probably a very basic question, how do I find out the difference between two system time. I tried x1 = t1.clock x2 = t2.clock x2 - x1 doesn't seem to give me the difference. Also trying this way ,
17
3779
by: abhimanyu.v | last post by:
Hi Guys, I have one doubt. The test program is given below. It uses two way of finding out the offset of a variable in structure. I executed the program and found the same result. My question is what is difference between 1) (unsigned long) &((struct foobar *)0)->foo and
3
1859
by: cheguashwini | last post by:
Hi I have a problem. I have two tables...table1 and table2. table1 has the column latitude and sno(serial number) and table2 has the column lat and sno(serial number) . i have to find the difference of all the values in column latitude from table 1 with all the values in column lat from table 2 and place it in a new table result having column difference i have written this code but i am getting error as missing elements. Can anyone please...
2
1986
by: Shamim1983 | last post by:
I want to find difference between 2 dates in number of months using GregorianCalendar utility. I want it to work fine considering the year having 28, 29, 30 or 31 days in month. It should give me exact difference in all possible cases. Please help soon. Thanks in advance.
275
12248
by: Astley Le Jasper | last post by:
Sorry for the numpty question ... How do you find the reference name of an object? So if i have this bob = modulename.objectname() how do i find that the name is 'bob'
0
8356
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8871
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
8783
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
8552
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
8640
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...
1
6198
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
4198
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4369
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2773
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 we have to send another system

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.