+ 3

How does one declare constant variables like 3.142,for PI?

16th Feb 2016, 6:18 AM
Elijah Murimi
9 Respostas
0
static final double PI = 3.141; Or you could just use Math.PI if you want greater precision.
28th Feb 2016, 2:38 AM
Steven Barnes
Steven Barnes - avatar
0
define("PI",3.1428); in php
1st Jul 2016, 8:44 AM
Midhun Mathew
0
there are many constants that are predefined in Java.
6th Aug 2016, 10:36 AM
Suyash Kathar
Suyash Kathar - avatar
0
define("PI",3.1428); in php anyone please help
8th Aug 2018, 9:44 AM
Collins Mutuma Gituma
Collins Mutuma Gituma - avatar
0
How to write a java statement to declare pi as a constant (pi=3.142).
31st Jul 2019, 6:01 AM
Lameck Mipawa
Lameck Mipawa - avatar
0
Create a float variable with a variable name of pie and with a value of 3.1416
11th Oct 2020, 4:56 AM
スロホ ヱゾェロ ă‚žăƒ‹ă‚·ăƒ«
スロホ ヱゾェロ ă‚žăƒ‹ă‚·ăƒ« - avatar
- 1
What would be the purpose of using PI in a program?
27th Jun 2016, 5:25 AM
ethan
ethan - avatar
- 1
constant variables can be declared by using constant keyword. for eg. constant double pi = 3.14 or constant variables can be declared by using Macro.
30th Jun 2016, 10:34 AM
Aishwarya Patil
Aishwarya Patil - avatar
- 1
If you want just declare constant variable you just wrote .. final float pi = 3.142f; Remember after declare float value is followed by f... examples 2.3 f
7th Jul 2016, 6:24 PM
Bhavesh
Bhavesh - avatar