11.programming Concepts
11.programming Concepts
# CONSTANT
Integer
Integers are whole numbers that can have both positive and negative
values but no decimal values.
Example: 0, -5, 10.
Float
Floating type variables can hold real numbers such as: 2.34, -9.382, 5.0
etc
Ex: FirstInteger = int(25) & FirstReal = float(25.5)
Char
Keyword char is used for declaring character type variables. For example:
char test = 'h';
Here, test is a character variable. The value of test is 'h'.
The size of character variable is 1 byte
String
A sting is a group of characters. Strings vary in length and may even have no characters: an empty
string. The characters can be letters and/or digits and/or any other printable symbol.
Boolean
BOOLEAN variable can have only two values: TRUE or FALSE.
Computer
Programs
r = float(input('Enter radius of the cylinder: '))
h = float(input('Enter the height of the cylinder: '))
Vol = float (0)
Pi = 3.14
Vol = Pi*r*r*h
Print(“the volume of the cylinder is:”,Vol)
Python program to add two numbers