Operations

I want to write code for :
1-square of a number
2-square root of a number
3-multiplication and division with decimals
Thanks
Dragos
I use Delphi 4 pro
EftodiAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
kretzschmarConnect With a Mentor Commented:
hi Eftodi,

1-square of a number -> SQR
2-square root of a number -> SQRT
3-multiplication and division with decimals -> * /

meikl
0
 
EftodiAuthor Commented:
Edited text of question.
0
 
kretzschmarCommented:
hi again Eftodi,

some samples

1-square of a number -> SQR -> SQR(4) -> 16
X := SQR(4); //X=16

2-square root of a number -> SQRT -> SQRT(16) -> 4
X := SQRT(16); //X=4

3-multiplication and division with decimals -> * / > 1.2*1.2 = 1.44; 2.4 / 1.2 = 2;
X := 1.2*1.2; //X=1.44
X := 2.4 / 1.2; //X := 2;

meikl
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
EftodiAuthor Commented:
The problem it is NOT solved
Declarations of :
 Var
- for decimals numbers for example
......
Thanks anyway
Dragos
0
 
kretzschmarCommented:
hi Eftodi,

well, vartypes, which can hold decimals

var
  X : Extended; or
  X : Single; or
  X : Double; or
  X : Currency; or
  X : Real;  //Maybe this is not supported by D4 -> Type Real48;

meikl
0
 
EftodiAuthor Commented:
Hi
For example :
a=-b/2-sqrt((sqr(b/2)-c)
I have some problem with the declaration of:
Var
Thanks
Dragos
0
 
kretzschmarCommented:
hi dragos,

a must be a type from above
b and c can be integer if no decimals, otherwise dito

sqr & sqrt returns a type extended, but will automatically transformed
to a double if a for example a type double.

meikl
0
All Courses

From novice to tech pro — start learning today.