[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

percentages

Posted on 2004-10-10
5
Medium Priority
?
375 Views
Last Modified: 2010-04-05
hey all, my question is

to keep it simple, lets say you have a bar thats 100 hundred long, and you have a line on it thats 36 long, what percentage would that line be long?
and vice versa, if you knew the percentage the line should be... how long would the line be?

Im usually very good in math, but for some reason Im having probs with this LOL
thanks in advance =)
0
Comment
Question by:LMuadDIb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 4

Accepted Solution

by:
brunomsilva earned 500 total points
ID: 12272775
Hi LMuadDIb,

36/100 = 0.36 = 36%

to find the opposite, suppose the bar is 150 long and you want a line that has 10%, multiply 150 * 10% (0.1) = 15

Cheers!
0
 
LVL 4

Author Comment

by:LMuadDIb
ID: 12272830
with a funtion I made I get an
[Error] misc.pas(22): Incompatible types: 'Integer' and 'Extended'

in delphi code, if you wanted a button to be 25% of the width of the form its sitting on, how would you code it?
0
 
LVL 4

Author Comment

by:LMuadDIb
ID: 12272853
DOH!
I also figured out my error which was another DOH! ;)
thanx
0
 
LVL 5

Expert Comment

by:Hypoviax
ID: 12272867
Expanding on brunomsilva,

__________________________________________________
Part A)
To calculate it in delphi:

Percentage:=(36 div 100) * 100; //will give you the percentage of 36

PartB)
The opposite (using brunomsilva example):

Length:=(150 * (10 div 100)); //will give you the length of 15

__________________________________________________

Similarly if we use straight variables so that it can be changed dynamically:
Part A)

var Percentage,linelength,barlength:Integer;
begin
       Percentage:=(LineLength div BarLength) * 100;
end;

Part B)

var Percentamount,Linelength,barlength:Integer;
begin
      LineLength:=(BarLength * (PercentAmount div 100));
end;
__________________________________________________

Regards,

Hypoviax

 
0
 
LVL 5

Expert Comment

by:Hypoviax
ID: 12272870
I was a bit slow in typing my post!!!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question